手动UINavigationBar布局问题

时间:2015-10-30 14:32:09

标签: ios iphone swift autolayout interface-builder

我正在创建一个使用UINavigationBar的屏幕。在设置约束时,我的前导余量= Superview的前导边距 - 20,在IB中呈现如此

constraints

当我向左边添加一个UIBarButtonItem(以编程方式或在IB中)时,按钮渲染得太靠近左边缘:

odd

我在这里做错了吗?

以下是此场景的约束:

constraints

2 个答案:

答案 0 :(得分:0)

而不是 UIBarButtonItem 通过IB拖动 UIButton

它将自动创建UI组件层次结构,如下图所示。

然后,您将能够更改按钮或对齐的内容/标题/图像插入内容。

enter image description here

答案 1 :(得分:0)

我在;WITH CTE( SELECT t2.col1 as c1 ,t2.col2 as c2 ,t3.col3 as c3 FROM table2 t2 INNER JOIN table3 t3 ON t2.col1= t3.col1 WHERE t3.col1>100 ) SELECT col1,col2,col3,tt.c1,tt.c2.tt.c3 FROM table1 t1 INNER JOIN CTE tt ON t1.col1= tt.col1 添加了UIBarButtonItem.FixedSpace,内容如下:

UINavigationItem

来源:How to Edit Empty Spaces of Left, Right UIBarButtonItem in UINavigationBar [iOS 7]