在我的UITextField中,当我键入@时,我能够显示一个包含数组值的弹出窗口。
但是现在我的客户需要做一些modifications.If a user type @,弹出窗口不应该出现,但当他在@后面键入任何字母时,所有以该字母开头的朋友名称都应该出现在弹出窗口中。例如:-如果用户键入@p,弹出窗口将显示所有以字母P开头的好友名称。
如何做到这一点,我已经尝试了一些东西,但无法实现(我在加载视图时获得了一个数组中的朋友列表),现在我正在使用
- (BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
if([string isEqualToString:@"@"]) {
s=1;
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.5];
[frndsView setCenter:CGPointMake(frndsView.center.x, frndsView.center.y-310)];
[UIView commitAnimations];
[commentField resignFirstResponder];
}
return YES;
}
https://stackoverflow.com/questions/14474598
复制相似问题