开发者

how to trigger an event of navigationitem rightBarButtonItem programmatically?

开发者 https://www.devze.com 2023-01-27 01:55 出处:网络
i created an navigationitem rightBarButtonItem in the following code and I would like to trigger its event programmatically ( just like click the bar button ). search everywhere but can\'t find how to

i created an navigationitem rightBarButtonItem in the following code and I would like to trigger its event programmatically ( just like click the bar button ). search everywhere but can't find how to do it. does anyone know the method? thx a lot.


    UIBarButtonItem *reloadbutt开发者_运维知识库on = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRefresh target:self action:@selector(Action1:)];
 self.navigationitem.rightBarButtonItem = reloadbutton;
 [reloadbutton release];
 


Since you already have an action method that you're using with the button, you can just call the method yourself; for example,

 [self Action1:self.navigationItem.rightBarButtonItem];
0

精彩评论

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

关注公众号