删除navigationItem.titleView后恢复navigationItem.title [英] Restoring navigationItem.title after removing navigationItem.titleView

查看:215
本文介绍了删除navigationItem.titleView后恢复navigationItem.title的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用有2个标签( tabA tabB ),根据我设置的位置 navigationItem.titleView tabB UIImageView - viewWillAppear:被调用。

My App has 2 tabs (tabA and tabB), based on location the I set the navigationItem.titleView of tabB to a UIImageView when - viewWillAppear: is called.

tabB的默认行为 只是显示标题,例如:

The default behaviour of tabB is to simply display a title, e.g:

问题是当位置发生变化时我删除 UIImageView navigationItem .titleView (使用 - removeFromSuperview ),默认标题也已消失,并尝试将其设置为:

The issue is when the location changes and I remove the UIImageView navigationItem.titleView (using - removeFromSuperview), the default title has also disappeared and trying to set it with:

self.navigationItem.title = @"TITLE";

不起作用。关于如何解决这个问题的任何想法?

Does not work. Any ideas on how to solve this?

推荐答案

只需设置:

navigationItem.titleView = nil;

将恢复文字标题。

这篇关于删除navigationItem.titleView后恢复navigationItem.title的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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