iOS11中缺少导航栏标题视图 [英] Navigation bar title view missing in iOS11

查看:58
本文介绍了iOS11中缺少导航栏标题视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 iPad 迅速开发一个项目.已从情节提要中将图像视图放置在导航栏标题视图中.标题视图在 iOS 10 及以下版本中按预期显示.当我在 iOS 11模拟器中运行并且物理设备导航栏未显示标题视图时,同一个项目,任何潜在客户都将不胜感激.

I'm working on a project in swift for iPad. Have placed an image view in Navigation bar title view from story board. The title view is displaying as expected in iOS 10 and below. The same project when i run in iOS 11 simulators and the physical devices Navigation bar is not showing the title view, any leads would be appreciated.

推荐答案

创建自定义视图,并在自定义标题视图类中覆盖以下方法,以在运行时更新视图框架大小.

Create a custom view and override below method in the custom title view class to update view frame size at runtime.

Obj-C

-(CGSize)intrinsicContentSize
{
    [super intrinsicContentSize];
    return UILayoutFittingExpandedSize;
}

Swift

override var intrinsicContentSize: CGSize {
    return UILayoutFittingExpandedSize
}

检查并让我知道它对您有用吗?

Check and let me know is it working for you or not ?

这篇关于iOS11中缺少导航栏标题视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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