[英]How can i disable in a Xcode project that a keyboard appears when i touch in a TextField?
[英]How can I change name of button when I touch textField?
我知道这是一个简单的问题,但我不知道该怎么办。 我的意思是我需要使用手势或某种方法,哪一种? 我尝试过使用FirstResponder和touch事件,但是所有这些都无法满足我的需要。 而且按钮的标题仅需要以一种方式更改-当我触摸textField时。 对不起我的英语不好。
使用UITextField
委托:
-(void)textFieldDidBeginEditing:(UITextField *)sender{
//[sender resignFirstResponder];// Resigning the KeyBoard.
[self.myButton setTitle:@"ddd" forState:UIControlStateNormal];
}
尝试以下代码:
[YourTextField addTarget:self
action:@selector(yourDesiredMethod)
forControlEvents:UIControlEventTouchUpInside];
-(void)yourDesiredMethod
{
[YourButton setTitle:@"YourTitleString" forState:UIControlStateNormal];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.