//在UITextField 中文字最左边距离左侧边框的距离
_textBoxName.leftView = [[UIView alloc] initWithFrame:CGRectMake(0,0,16,51)];
_textBoxName.leftViewMode = UITextFieldViewModeAlways;
=============== 华丽的分割线 =============
//监听UITextField的text的变化:
// 注册监听
[[NSNotificationCenterdefaultCenter]postNotificationName:UITextFieldTextDidChangeNotificationobject:nil];
[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(changeForKeyWord:)name:UITextFieldTextDidChangeNotificationobject:nil];
// 监听关键词变化
- (void)changeForKeyWord:(NSNotification*)sender
{
// 关键词改变时清除地区查询条件纪录
[[NSUserDefaultsstandardUserDefaults]setObject:@"0"forKey:@"proRow"];
[[NSUserDefaultsstandardUserDefaults]setObject:@"0"forKey:@"section"];
}
//监听UITextField的点击事件
[[NSNotificationCenterdefaultCenter]postNotificationName:UITextFieldTextDidBeginEditingNotificationobject:nil];
[[NSNotificationCenterdefaultCenter]addObserver:selfselector:@selector(enterEdited:)name:UITextFieldTextDidBeginEditingNotificationobject:nil];
- (void)enterEdited:(NSNotification*)sender
{
//事件写这里!希望帮到你!
}
网友评论