问题标签 [titleview]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
672 浏览

ios - 具有动态宽度的 UINavigationItem titleView

我正在使用a inside a的titleView属性。有什么方法可以动态调整 ' 的宽度以填充左侧任何按钮和右侧任何按钮之间的空间?(理想情况下无需手动计算)UINavigationBarUINavigationControllertitleView

0 投票
2 回答
5707 浏览

cocoa-touch - Autoresize titleView in a NavigationBar with autolayout

I want a custom UIView in my UINavigationBar between a left and a right BarButtonItem but as wide as possible. For this reason I added a UIView in IB to the NavigationBar. With autolayout disabled everything works as expected with the autoresizing masks. But in my storyboard with autolayout enabled I just cann't get it to work. It doesn't look like I can set any constraints in IB for the titleView. If I rotate my device to landscape mode, the UIView has still the same width. What do I have to do so that the titleView fills the space between my UIBarButtonItems with autolayout enabled?

Thank you for any help

Linard

0 投票
2 回答
504 浏览

ios - 无法将 UIScrollView 添加到 UINavigationBar

我希望scrollview将 my 添加为UINavigationBar's titleview,但奇怪的是我无法这样做。

在 viewDidLoad 中:

这是一段非常简单的代码,但我无法弄清楚我缺少什么。请有人帮助我...谢谢。

旁注:我在UINavigationController没有任何根控制器的情况下启动,因为我首先关心的是向导航栏添加滚动视图。

0 投票
1 回答
1074 浏览

ios - 如何修复titleView在过渡期间被隐藏到导航栏?

在我的视图控制器中,我将 a 设置titleView为 a UIView,其中包含 aUIImageView在其层上使用 setCornerRadius 制成的圆形。

圆圈的上半部分位于导航栏上方,下半部分位于视图上方,如下所示:

一个

现在,当我推动这个视图控制器时,当它动画化时,圆的下半部分被切断,直到动画完成。仅显示导航栏中的部分,如下所示

乙

推送动画一结束,就会显示完整的圆圈。titleView有什么办法可以阻止导航栏在动画发生时屏蔽/切断,以便在动画期间显示整个圆圈?

0 投票
1 回答
6206 浏览

iphone - NavigationItem Titleview centered on the navigationbar under IOS 7 - impossible?

I'm asking since the usual answer, modifying the frame in viewDidLayoutSubviews, does not work - unless you can find a mistake in my code. The frame gets set to the correct width and height, but iOS 7 does not respect the frame.

Currently, the app released long ago looks like this and works on iOS 6 and 7: https://itunes.apple.com/se/app/eksjo/id435475192?mt=8

Recompiling gives this: https://www.dropbox.com/s/pzyv2vhtlmlxkoe/Photo%202013-12-11%2009%2047%2030.png

All I want to do is put a logo image in the center of the Navigation Bar. I'm looking for a minimum code change to the viewWillAppear code to do this and still be compatible with iOS 6.x.

Edit: It may also be an iOS 6 issue and not an iOS 7 issue. If you can explain why it should be done like in this question, it's an answer to my question: My UINavigationitem's TitleView getting expanded in ios 6

0 投票
2 回答
2215 浏览

ios - 导航项标题视图中的iOS图像

我想在导航栏中添加图像。为此,我写道:

它正在运行,但唯一的问题是图像似乎模糊了。当我在 Photoshop 或其他软件上查看时,图像是完美的。

此图像的大小为:120 x 30 像素。

有人帮我吗?谢谢

0 投票
0 回答
74 浏览

ios - 可变宽度标题 UINavigationController

我有的 :

我想要的是 :

我已经尝试titleView在我的 上设置 custom UINavigationController navigationItem,我已经尝试设置 custom backItem,但到目前为止我还没有达到令人满意的结果。最糟糕的是,当我尝试titleView从控制器以编程方式设置宽度时,它不会增长到一侧,而是保持居中。

我还考虑过仅对顶部导航栏进行子类化,但找不到任何示例或将我的头绕在它周围。

任何建议都非常感谢!

0 投票
0 回答
338 浏览

ios - 导航项标题视图中的标签定位问题

我正在尝试在导航项标题视图中放置一个标签。在长标题的情况下,在推送/弹出到其他屏幕时,标签会从其原始位置移动并发生过渡。
设置标签的代码:

0 投票
1 回答
119 浏览

ios - 在应用程序内多次自定义相同的 UINavigationBar

我正在使用 titleTextAttributes 使用不同的颜色和自定义字体自定义 UINavigationBar。但是,当我移动到另一个视图时,我想使用与以前不同的颜色和相同的自定义字体。

我用过,

在 AppDelegate.m 中。在另一个 viewController 的 viewDidLoad 中使用 newSettings 调用相同的方法时,它不会被反映。

我可以在另一个 viewController 的 viewDidLoad 中更改条形颜色或条形色调颜色。但是,我的标题前景色没有改变。我错过了什么吗?

我必须有自定义titleView的最后一个解决方案。却想避而远之。有什么输入吗?

0 投票
0 回答
755 浏览

objective-c - UISearchBar 不适合 iPad 上的 UINavigationBar - iOS 8

我试图在 UINavigationBar 的 titleView 中放置一个 UISearchBar。

我有两个解决方案,都不方便。

首先是:

不搜索时,结果看起来还可以。

非搜索模式

但是当搜索开始时,titleView 在右侧扩展太多。事实上,取消按钮是可见的,但只是不在屏幕上......

在此处输入图像描述

这个答案中,我尝试将 UISearchBar 包装在另一个 UIView 中,然后再将其添加到 navigationItem 中。

结果如下:

不搜索:

在此处输入图像描述

搜索:

在此处输入图像描述

我正在管理在 UISearchController 的委托方法中显示/隐藏自己的左/右栏按钮项目。

这发生在模拟器中,仅在 iPad 上。

有任何想法吗?