ios中Search Paths的理解


上边的图片里边展示了shange.framework和ermei.framework两个框架在项目中的位置 :

shangge.framework这个框架在.xcodeproj的同级目录中,在Search Paths中的Framework User Paths中设置的位置为具体的位置为:


ermei.framework这个框架在.xcodeproj的同级的下级目录中,在Search Paths中的Framework User Paths中设置的位置为  具体位置为:


再后来我自己测试了一下 $(SRCROOT) 与 $(PROJECT_DIR) 这两个标记表示的路劲都是一样的都是指的项目的根目录,也就是.xcodeproj那个目录。


为什么我们要去设置Search Paths啦? 因为我们常常往工程中添加其他第三方的框架,


但是我们添加是添加了,而且相当容易添加,但是当我们添加后,如果编译,有时候会发现找不到我们添加的那个框架,这就是因为编译的时候没有指定我们所添加的框架的路劲,或者该框架添加的路径出现了错误,从而我们必须要在Search Paths中去设置修改我们所需要的库的路径,这样才能保证我们的框能够正常引入并使用


关于头文件的使用,在search paths中也有一个设置头文件路劲的选项,基本同上一样的道理,如果我们引用上边添加的某个库中的.h文件,那么我们需要使用#import <xx/yy.h>等,这个不一定,似具体情况来看,看你怎么设置的头文件查询路劲.

self.dataList=[NSMutableArray arrayWithCapacity:1000]; for (NSInteger i=0; i<1000; i++) { [self.dataList addObject:[NSString stringWithFormat:@"010000----201200%ld",(long)i]]; } // Do any additional setup after loading the view from its nib. } -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ if (tableView == self.searchDisplayController.searchResultsTableView) { return [self.searchList count]; }else{ return [self.dataList count]; } } -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *flag=@"cellFlag"; UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:flag]; if (cell==nil) { cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:flag]; } if (tableView==self.searchDisplayController.searchResultsTableView) { [cell.textLabel setText:self.searchList[indexPath.row]]; } else{ [cell.textLabel setText:self.dataList[indexPath.row]]; } return cell; } //UISearchBarDelegate德开始和结束的事件: - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar{ NSLog(@"搜索Begin"); return YES; } - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar{ NSLog(@"搜索End"); return YES; } - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString{ // 谓词的包含语法 NSPredicate *preicate = [NSPredicate predicateWithFormat:@"SELF CONTAINS[c] %@", searchString]; if (self.searchList!= nil) { [self.searchList removeAllObjects]; } //过滤数据 self.searchList= [NSMutableArray arrayWithArray:[_dataList filteredArrayUsingPredicate:preicate]]; //刷新表格 return YES; }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值