所以我只是在使用普通的 View Controller 。我将一个导航栏拖到顶部并添加了一个带有“暂停”标识符的 UIBarButtonItem。
我希望能够将该标识符更改为“播放”标识符。
这可能吗?我找不到关于它的任何信息。
我尝试创建一个新的,但不确定从那里去哪里。
UIBarButtonItem *flipButton = [[UIBarButtonItem alloc]
initWithTitle:@"Flip"
style:UIBarButtonItemStyleBordered
target:self
action:@selector(flipView)];
任何帮助都会很棒。
最佳答案
您正在寻找 UIBarButtonSystemItemPlay
。只需设置它,分配您的选择器和目标,然后选择您想要的 barButtonItem。
UIBarButtonItem *playButton = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemPlay target:self action:@selector(playButtonPressed:)];
self.navigationItem.rightBarButtonItem = playButton;//Or leftBarButtonItem if you want it to be on the left
关于ios - 以编程方式更改 UINavigationBar 上的 UIBarButtonItem 标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24942187/