开发者

how can i fire button action event without any user action iphone xcode?

开发者 https://www.devze.com 2023-01-01 21:37 出处:网络
how can i fire button action event without any user ac开发者_运维技巧tion? pls give me any sample..UIButtons are subclass of UIControl.They use the sendActionsForControlEvents: method to send out eve

how can i fire button action event without any user ac开发者_运维技巧tion?

pls give me any sample..


UIButtons are subclass of UIControl. They use the sendActionsForControlEvents: method to send out events. You can call that method on the button (or control) to have the actions sent.

[theButton  sendActionsForControlEvents: UIControlEventTouchUpInside];


If user dont want to fire action on button,why do you show button,without showing button,u can do action.I think u need dynamic code (without interface builder),the code is

 [button1 addTarget:self action:@selector(action1:) forControlEvents:UIControlEventTouchUpInside];

 -(void) action1:(id)sender;

{ } hope this will help....

0

精彩评论

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