博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
代码片段
阅读量:6587 次
发布时间:2019-06-24

本文共 7306 字,大约阅读时间需要 24 分钟。

 
 
 
 
分割字符串:NSArray *tempArr = [fileName componentsSeparatedByString:@"."];
 

 

//颜色    UIColor  *backgroundColor=[UIColor redColor];    //字体    UIFont *font=[UIFont boldSystemFontOfSize:18.0];    NSDictionary *attrsDic=@{                             NSForegroundColorAttributeName:backgroundColor,                             NSFontAttributeName:font                             };    self.mySearchBar.attributedPlaceholder = [[NSAttributedString alloc]initWithString:@"请输入展品编号" attributes:attrsDic];
 

 

#pragma mark - 更新主页面操作    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,0),^{        //耗时的操作       dispatch_async(dispatch_get_main_queue(),^{            //更新界面        });    });    #pragma mark - 顺序执行//    dispatch_queue_t aqueue = dispatch_queue_create("sdfs",DISPATCH_QUEUE_CONCURRENT);//    dispatch_barrier_async(aqueue, ^{NSLog(@"1111");});//    dispatch_barrier_async(aqueue, ^{NSLog(@"2222");});//    dispatch_barrier_async(aqueue, ^{NSLog(@"3333");});        #pragma mrak - 随机执行//    dispatch_queue_t aqueue = dispatch_queue_create("sdfs",DISPATCH_QUEUE_CONCURRENT);//    dispatch_async(aqueue, ^{//        NSLog(@"111");//    });//    dispatch_async(aqueue, ^{//        NSLog(@"222");//    });//    dispatch_async(aqueue, ^{//        NSLog(@"666");//    });//    dispatch_async(aqueue, ^{//        NSLog(@"999");//    });        #pragma mark - 队列执行//    dispatch_queue_t aqueue = dispatch_queue_create("sdfs",DISPATCH_QUEUE_CONCURRENT);//    dispatch_group_t group = dispatch_group_create();//    dispatch_group_async(group,aqueue, ^{//        NSLog(@"1111");//        [NSThread sleepForTimeInterval:1.0];//    });//    dispatch_group_async(group,aqueue, ^{//        NSLog(@"2222");//        [NSThread sleepForTimeInterval:2.0];//    });//    dispatch_group_async(group,aqueue, ^{//        NSLog(@"3333");//        [NSThread sleepForTimeInterval:3.0];//    });//    //    dispatch_group_notify(group, aqueue, ^{//        NSLog(@"finish");//    });

 

@property(strong,nonatomic)UIRefreshControl *refresh;[self.refresh beginRefreshing];//viewWillAppear    [self refreshAction:nil];self.refresh = [[UIRefreshControl alloc]init];//viewDidLoad    [self.refresh addTarget:self action:@selector(refreshAction:) forControlEvents:UIControlEventValueChanged];    self.refresh.attributedTitle = [[NSAttributedString alloc]initWithString:@"下拉刷新"];    [self.myTableView addSubview:self.refresh];#pragma mark - refreshMethods-(void)refreshAction:(NSString*)str{    [self.refresh performSelector:@selector(endRefreshing) withObject:nil afterDelay:2.0];    [self.myTableView reloadData];}

 

NSString *resourcePath = [NSString stringWithFormat:@"%@/Resource",[declare applicationLibraryDirectory]];    if (![[NSFileManager defaultManager]fileExistsAtPath:resourcePath]) {        [[NSFileManager defaultManager] createDirectoryAtPath:resourcePath withIntermediateDirectories:NO attributes:nil error:nil];    }

 

@property (nonatomic, strong) NSArray *dataArray;

#pragma mark - tableView delegate#define Row_Height 100- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{    return Row_Height;}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{    return self.dataArray.count;}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{    static NSString *cellName = @"cell";    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellName];        if (!cell) {        cell = [[UITableViewCell alloc]init];        //        cell.selectionStyle = UITableViewCellSelectionStyleNone;    }        return cell;}- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{    }
 

 

//筛选信息    NSArray *arr = [[NSArray alloc]initWithObjects:@"beijing",@"shanghai",@"tianjin",@"shenzhen", nil];    NSString *string = @"in";    NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF CONTAINS %@",string];    NSLog(@"%@",[arr filteredArrayUsingPredicate:pred]);//提取字符串中的字母或数字    NSString *originalString = @"daxf1bw2cq3d45f6ge7h8i9j0";        // Intermediate    NSMutableString *numberString = [[NSMutableString alloc] init];    NSString *tempStr;    NSScanner *scanner = [NSScanner scannerWithString:originalString];    NSCharacterSet *numbers = [NSCharacterSet characterSetWithCharactersInString:@"qwe"];        while (![scanner isAtEnd]) {        // Throw away characters before the first number.        [scanner scanUpToCharactersFromSet:numbers intoString:NULL];                // Collect numbers.        BOOL isSccess = [scanner scanCharactersFromSet:numbers intoString:&tempStr];;        [numberString appendString:tempStr];        tempStr = @"";                NSLog(@"tempStr:%@   numberString:%@   bool:%d",tempStr,numberString,isSccess);    }//导航条按钮UIButton *rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];    rightBtn.backgroundColor = [UIColor clearColor];    rightBtn.frame = CGRectMake(0, 0, 40, 40);    [rightBtn setImage:[UIImage imageNamed:@"button5"] forState:UIControlStateNormal];    [rightBtn setImage:[UIImage imageNamed:@"button5_pressed"] forState:UIControlStateHighlighted];    [rightBtn addTarget:self action:@selector(rightBtnClick:) forControlEvents:UIControlEventTouchUpInside];    UIBarButtonItem *barBtn = [[UIBarButtonItem alloc]initWithCustomView:rightBtn];    self.navigationItem.rightBarButtonItem = barBtn;        UIBarButtonItem *nItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:self action:nil];    self.navigationItem.leftBarButtonItem = nItem;//宏定义 变量字符串化#define WARN_IF(EXP) \do { if (EXP) \        fprintf( stderr,"Warning " #EXP "\n" ); \} while(0)    int x = 0;    WARN_IF(x == 0);//cookiesNSHTTPCookieStorage *pool = [NSHTTPCookieStorage sharedHTTPCookieStorage];NSArray *cookies = [pool cookies];for (NSHTTPCookie *cookie in cookies ) {    [pool deleteCookie:cookie];}isFinite( number ) 函数用于检查其参数是否是无穷大。如果 number 是有限数字(或可转换为有限数字),那么返回 true。否则,如果 number 是 NaN(非数字),或者是正、负无穷大的数,则返回 false学习了FMDB三方库的使用,对sqlite进行操作时 表名、参数名不用带单引号 值必须带单引号 如:@"UPDATE %@ SET %@ = '%@' WHERE %@ = '%@'", TABLENAME,  AGE, @"15", AGE, @"12”//修改数据

 

segue跳转:

[self performSegueWithIdentifier:@"goToRootView" sender:nil];

 

添加tableViewcell编辑操作。//-(UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath//{   //    return UITableViewCellEditingStyleDelete;//}////- (void)tableView:(UITableView*)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath*)indexPath {//    if (editingStyle == UITableViewCellEditingStyleDelete) {//        //        //[self.da removeObjectAtIndex:indexPath.row];//        [self.myTableView deleteRowsAtIndexPaths:@[indexPath]//                                withRowAnimation:UITableViewRowAnimationAutomatic];//        [self.myTableView reloadData];//    }//}////-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath//{//    return YES;//}

 

//    [self.myTableView beginUpdates];

//    NSArray *indexPaths = @[indexPath];

//    [self.myTableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationLeft];

//    [self.myTableView endUpdates];

转载于:https://www.cnblogs.com/ceasar/p/5264330.html

你可能感兴趣的文章
机器学习之最优化问题
查看>>
MFC获得当前用户等信息
查看>>
在javascript中substr和substring的区别是什么
查看>>
java并发回答
查看>>
C++_基础2-复合数据类型
查看>>
镜像翻转二叉树
查看>>
Oracle 12 Rman增量备份
查看>>
[LeetCode]Pow(x, n)
查看>>
响应式 获取数据
查看>>
如何处理DataFrame中缺失项
查看>>
window下git笔记
查看>>
数据挖掘十大经典算法 优劣势
查看>>
PCB上LED指示灯电流、电压总结
查看>>
点击按钮表单元素左右移动
查看>>
[CDQ分治][Treap][树状数组]Theresa与数据结构
查看>>
安卓开发环境配置及HelloWorld
查看>>
学习笔记4
查看>>
Ubuntu10.04下Linux内核编译的完整步骤
查看>>
越南FCK批量拿站
查看>>
使用@crossorgin注解解决跨域问题
查看>>