如果想让通过代码让uitextfield获得焦点,调[uitextfield becomeFirstResponder]比如按下按钮 10秒后 才能继续点击。
-(void) buttonPressed{
buttonenabled = NO;
[NSTimer scheduledTimerWithTimeInterval:100f target:self selector:@selector(buttonPress) userInfo:nil repeats:NO];
}
-(void) buttonPress{
buttonenabled = YES;
}- (void)viewDidLoad { [ [NSNotificationCenter defaultCenter]addObserver:self selector:@selector(textChange)name:UITextFieldTextDidChangeNotification object:_textF]; } -(void)textChange { _btnenabled= selftextFtextlength>0; }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)