开发者

Edit UIButton text with keyboard

开发者 https://www.devze.com 2023-03-08 03:48 出处:网络
I have a UIButton that responds to a TouchUpInside ev开发者_StackOverflowent.Inside this event handler, I want to bring up the keyboard and allow the user to edit the text of the button.I have tried t

I have a UIButton that responds to a TouchUpInside ev开发者_StackOverflowent. Inside this event handler, I want to bring up the keyboard and allow the user to edit the text of the button. I have tried to set editing to YES as shown below, but this gives an unrecognized selector message...

-(void)editSelection:(id)sender
{
    [sender setEditing:YES];
}

Is there a way to edit text if the sender is a UIButton?


best set a text field over the button ( a borderless one) - and then [self.myVeryOwnButton setTitle:@"something" forControlState:UIControlStateNormal];

something of that nature.


I ended up creating a UITextField with the same frame as the button.

0

精彩评论

暂无评论...
验证码 换一张
取 消