Prc*_*ela 7 uinavigationbar ios
第一个屏幕截图是在全屏播放视频之前拍摄的.
第二个是在视频全屏打开并关闭后拍摄的.
知道为什么导航工具栏有扩展吗?
注意:汉堡包按钮不是导航项的一部分.它在父级的覆盖中伪造,将其子控制器保存在标准容器中.
源内没有什么特别之处:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
bbiListic = UIBarButtonItem(image: UIImage(identifier: .IcoHeaderListic), style: .Plain, target: self, action: #selector(UIViewController.showListic))
bbiFavorite = UIBarButtonItem(image: UIImage(identifier: .IcoHeaderStarEmpty), style: .Plain, target: self, action: #selector(LiveDogadjajViewController.toggleFavorite(_:)))
...
let items = [bbiListic!,bbiFavorite!]
navigationItem.rightBarButtonItems = items
}
func someRefresh() {
var items = [UIBarButtonItem]()
items.append(bbiListic!)
...
navigationItem.rightBarButtonItems = items
}
Run Code Online (Sandbox Code Playgroud)
更新:
这似乎仅在最新版本的iOS 9.3上存在问题
我就这个问题联系了苹果开发者技术支持。他们确定这可能是 iOS 9.3 中的一个错误。
错误 ID:26439832,iOS SDK
对于堆栈上的视图控制器来说,这是一个简单的解决方法:
// ... add this to init method
let nc = NSNotificationCenter.defaultCenter()
nc.addObserver(self, selector: #selector(didExitFullscreen(_:)), name: MPMoviePlayerDidExitFullscreenNotification, object: nil)
func didExitFullscreen(notification: NSNotification)
{
// hack, fix for 9.3.
if #available(iOS 9.3, *)
{
navigationController?.setNavigationBarHidden(true, animated: false)
navigationController?.setNavigationBarHidden(false, animated: false)
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
144 次 |
| 最近记录: |