大佬教程收集整理的这篇文章主要介绍了iphone – 将自定义选择器添加到UIBarButtonItem,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
UIBarButtonItem *doneBarButtonItem=[[UIBarButtonItem alloc] init]; doneBarButtonItem.title=@"Done"; self.navigationItem.rightBarButtonItem = doneBarButtonItem; [doneBarButtonItem release];
UIBarButtonItem *buttonHello = [[UIBarButtonItem alloc] initWithtitle:@"Say Hello" style:UIBarButtonItemStyleBordered target:self action:@SELEctor(sayHello:)];
另一种方法是在创建目标和动作后设置它
[buttonHello setTarget:self]; [buttonHello setAction:@SELEctor(sayHello:)];
目标是将被调用的对象的实例.在self的情况下,该方法将在该对象的实例上.
Action是被调用的方法.通常,您可以使用IBACtion来装饰它,以向设计师提示它是一个动作.它编译失效.
- (IBACtion)sayHello:(id)sender { // code here }
以上是大佬教程为你收集整理的iphone – 将自定义选择器添加到UIBarButtonItem全部内容,希望文章能够帮你解决iphone – 将自定义选择器添加到UIBarButtonItem所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。