我想拦截对 a 的触摸UITextField
,例如,当我第一次加载它时,我给它 a@selector()
以加载不同的方法而不是delegate
东西?
这是我的尝试:
descriptionText = [[UITextField alloc] initWithFrame:CGRectMake(10.0, 25.0, infoView.frame.size.width - 20, 100.0)];
descriptionText.backgroundColor = [UIColor whiteColor];
descriptionText.textColor = [UIColor blackColor];
descriptionText.contentVerticalAlignment = UIControlContentVerticalAlignmentTop;
descriptionText.userInteractionEnabled = YES;
[descriptionText addTarget:self action:@selector(loadInfoView:) forControlEvents:UIControlEventTouchUpInside];
descriptionText.font = [UIFont fontWithName:@"Helvetica" size:15];
// show view
[infoView addSubview:descriptionText];
但是,当我调试该方法时:
- (void)loadInfoView
{
NSLog(@"load other view here");
}