添加约束到的UIBarButtonItem [英] Adding constraints to a UIBarButtonItem

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

问题描述

X code未让我把限制我的 BarButtonItem 上的MainStoryBoard一个的ViewController。它的出现太多的地方它是不可读如所示的图像在左

Xcode is not allowing me to put constraints on my BarButtonItem on a ViewController in the MainStoryBoard. It's appearing too far to the left where it's unreadable as shown in the image.

下面显示了 BarButtonItem 是图像。它应该说项。我也看了关于X code中的preVIEW分割的画面上,它看起来罚款的iPhone6​​但不能用于iPhone 4(它切成两半的iPhone 4,但在这里它的3 / 4S切)。在这里,我正在为iPhone 6和我得到。

The image below shows where the BarButtonItem is. It's supposed to say "Item". I also looked on the preview split screen on Xcode and it looked fine for the iPhone6 but not for the iPhone 4 (it's half cut on the iPhone 4 but here its 3/4s cut). Here I'm running for the iPhone 6 and i get that.

我如何添加英寸x code约束或者我如何编程方式添加的约束这个BarButtonItem?

How do I add constraints in Xcode or how do I add the constraints programmatically to this BarButtonItem?

在这里输入的形象描述

任何帮助很多AP preciated。

Any help is much appreciated.

推荐答案

拖放在厦门国际银行/故事板掉落导航栏

Drag and drop navigation bar in your xib / story board

在这里输入的形象描述

ü可以约束这个导航栏添加按照您的要求。

U can add constraints to this navigation bar as per your requirement.

然后加入栏按钮项目到您的导航栏

Then add Bar Button Item to your navigation bar

在这里输入的形象描述

栏按钮项目采取它默认位置 - 可以不包含自动布局在那里。

Bar Button Item takes it default position u cannot incorporate autolayout there.

虽然如果u想栏按钮项固定或灵活ü可以用固定空间栏按钮项或灵活的空间栏按钮项的位置。

Although if u want positions of Bar Button Item Fixed or Flexible u can make use of Fixed Space Bar Button Item or Flexible Space Bar Button Item.

在这里输入的形象描述

如果位置是固定的你的两个栏按钮项目的拖累之间固定的空间栏按钮。
如果位置不固定你的两个栏按钮项之间灵活的阻力灵活空间栏按钮项。

If positions are fixed drag Fixed Space Bar Button between your two Bar Button Item's. And if positions is not fixed its flexible drag Flexible Space Bar Button Item between your two Bar Button Item's.

编码快乐..:)

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

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