如何更改 UIBarButtonItem 标题 - iPhone SDK
任何人都可以帮助我,因为我只是尝试更改来自不同类的 UIBarButtonItem 上的标题。
我的代码是:
- (IBAction) spanishPush {
SafetyTalks *bbiTitle = [[SafetyTalks alloc] init];
bbiTitle.bbiOpenPopOver.title = @"Spanish";
}
SafetyTalks = 我试图引用的类 bbiOpenPopOver = UIBarButtonItem。
我可以在 SafetyTalks 课程中通过简单的方式更改标题:
bbiOpenPopOver.title = @"Talk Topics";
但在离开该课程时则无法更改标题。
请帮忙。
安迪
Can anyone help me in that I am only trying to change the Title on an UIBarButtonItem from a different class.
My code is:
- (IBAction) spanishPush {
SafetyTalks *bbiTitle = [[SafetyTalks alloc] init];
bbiTitle.bbiOpenPopOver.title = @"Spanish";
}
SafetyTalks = the class I am trying to reference
bbiOpenPopOver = the UIBarButtonItem.
I can change the Title when in the SafetyTalks class by simple:
bbiOpenPopOver.title = @"Talk Topics";
but cannot do it when I am out of that class.
Please help.
Andy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以做的是在
SafetyTalks
类中定义一个属性。声明它并提供自定义 getter 和 setter。这样,标题就可以在类外获取和设置。在头文件中添加:
在源文件中添加:
What you can do is to define a property in the
SafetyTalks
class. Declare it and provide custom getter and setter. This way, the title can be get and set outside the class.In the header file, add:
In the source file, add: