[英]change BarButton item identifier on code
I have a bar button item on StoryBoard,its identifier is Play, How can I change this bar button's identifier on code? 我在StoryBoard上有一个条形按钮项目,其标识符为Play,如何在代码上更改此条形按钮的标识符?
- (IBAction)play:(UIBarButtonItem *)sender {
// For example,when I touch this button,
// it change its Identifier to Stop
}
use UIButton
's tag
features 使用
UIButton
的tag
功能
using UIButton
outlet set tag for play like testButton.tag = 1;
使用
UIButton
插座设置标签进行播放,例如testButton.tag = 1;
then in 然后在
- (IBAction)play:(UIBarButtonItem *)sender {
if (sender.tag == 1) {
testButton.tag = 2;
} else if (sender.tag == 2) {
testButton.tag = 1;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.