工具栏工具栏按钮项在SplitViewController中无法正常工作 [英] Toolbar bar button item not working properly in SplitViewController

查看:78
本文介绍了工具栏工具栏按钮项在SplitViewController中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一个奇怪的问题,类似于这个问题.我的工具栏最左侧的条形按钮项的触摸检查器不正确.就我而言,只有在我在SplitViewController的DetailViewController中添加工具栏并在iPhone上运行它时,这种情况才会发生.

I'm having a weird problem that is similar to this post or this question. My toolbar's far left bar button item's touch censor is off place. In my case this only happens when I add toolbar in DetailViewController in SplitViewController and run it on the iPhone.

红色字段是项目按钮的异地触摸检查器.

Red field is the off place touch censor for the item button.

我尝试了很多事情,这些都是我发现的.我正在使用Xcode 6.

I've tried many things and those are the things that I found out. I'm using Xcode 6.

  • 仅在工具栏位于SVC的DetailViewController中时发生
  • 仅当您在iPhone而非iPad上运行它时才会发生
  • 仅当它被限制在DetailViewController的底部时才会发生
  • 它只会发生在工具栏最左侧的按钮上

以前有人遇到过同样的问题吗?如果没有,我将不胜感激,如果您可以通过简单地创建一个新的Master-Detail项目并在DetailViewController中添加工具栏并将其约束到底部并在iPhone模拟器或设备上运行它来进行尝试.如果导致相同的问题,请分享.似乎没有明确的答案,所以我想知道Xcode是否存在问题.我想出的唯一解决方案是改用标签栏.请就此分享您的想法或解决方案.

Has anyone had the same problem before? If not, I would very much appreciate it if you could try it yourself by simply creating a new Master-Detail project and add toolbar in DetailViewController and constrain it to the bottom and run it on the iPhone simulator or a device. Please share if it causes a same problem. There doesn't seem to be any clear answer to this so I'm wondering if there's a issue with the Xcode. Only solution I came up with is to use tab bar instead. Please share your thoughts or solution on this.

我已经将Item按钮连接到IBAction,当我触摸Item时,它确实被触发了.我以为它不起作用,因为除非我触摸红色区域,否则它不会提供Flash动画.IBAction被调用,但是除非我触摸红色区域,否则它仍然不提供Flash动画.并且项目按钮的触摸检查器字段似乎太大.

I've connected the Item button to IBAction and it does get triggered when I touch on Item. I thought it was not working because it doesn't give the flash animation unless I touch the red field. IBAction gets called but it still doesn't give the flash animation unless I touch on the red field. And touch censor field for the item button seems too large.

推荐答案

我还发现我无法使用 self.itemButton.title = @"Changed Title这样的方法在代码中更改此按钮的标题; ,但是我通过在两个按钮之间切换来解决了这个问题.

I've also found out that I cannot change the title of this button in code with method like self.itemButton.title = @"Changed Title";, but I solved this by switching between two buttons.

- (IBAction)editAction:(id)sender {
    [self.toolBar setItems:@[self.doneButton]];
}

- (IBAction)doneAction:(id)sender {
    [self.toolBar setItems:@[self.editButton]];
}

更新:

此问题已在Xcode 6.2中解决.

This issue has been resolved in Xcode 6.2.

这篇关于工具栏工具栏按钮项在SplitViewController中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆