iOS11 UIBarButtonItem不起作用 [英] iOS11 UIBarButtonItem not working

查看:69
本文介绍了iOS11 UIBarButtonItem不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在商店中有一个应用程序正在运行.我正在尝试为iOS11版本做好准备,但遇到了一个令人讨厌的问题.

I have an app that is live in the store. I am trying to get it ready for the iOS11 release but have run into an annoying problem.

应用程序中的UIBarButtonItem均未正常运行. leftBarButtonItems是可单击的,但单击区域在该项目的右侧稍稍. rightBarButtonItems根本不起作用!我已经通过情节提要和代码添加了项目,但似乎都没有用.请帮忙!

None of the UIBarButtonItems in the app are working properly. The leftBarButtonItems are clickable but the click area is slightly to the right of the item. The rightBarButtonItems are not working at all! I have added the items both via the storyboard and via code but none of them seem to be working. Please help!

这是一个例子:-

navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("Save", comment: "save button title"), style: UIBarButtonItemStyle.plain, target: self, action: #selector(VC.rightBarButtonClicked(_:)))

推荐答案

出现了同样的问题.它归结为UIButton在我们项目中名为"UIButton + MinimumTouchArea.swift"的文件中的扩展名,该文件覆盖了UIButton.hitTest并在iOS 11中破坏了UIBarButtonItem.花了整整一天的时间才弄清楚!

Had the same issue. It came down to an extension on UIButton in a file called "UIButton+MinimumTouchArea.swift" in our project which overrides UIButton.hitTest and breaks UIBarButtonItem in iOS 11. It took us a the whole day to figure out!

这篇关于iOS11 UIBarButtonItem不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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