您的位置:首页 > 移动开发 > IOS开发

根据输入的textField首字符排序

2016-07-16 07:50 369 查看
textfield的值发生改变时.调用方法筛选

    [[NSNotificationCenter

defaultCenter]

addObserver:self

selector:@selector(search:)

name:UITextFieldTextDidChangeNotification

object:nil];

}

-(void)search:(NSNotification*)notification{

   
NSString*str = [NSString

stringWithFormat:@"SELF like [c] '*%@*'",_tf.text];

   

   
NSPredicate*predicate = [NSPredicate

predicateWithFormat:str];

   

   
_dataAarray
= [_dataArray1

filteredArrayUsingPredicate:predicate];

   

    [_collection

reloadData];

//label内容自适应

 _label.contentMode
=UIViewContentModeScaleAspectFit

获得导航栏上按钮的视图
    UIView*v
= self.navigationItem.rightBarButtonItem.customView;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  iOS开发