PTT
Submit
Submit
选择语言
正體中文
简体中文
PTT
MacDev
Re: [问题] Autolayout使用问题
楼主:
whitefur
(白毛)
2014-02-12 09:59:54
※ 引述《kiii210 (JohnnyChian)》之铭言:
: 大家好,上来请教一下各位高手...小弟在Autolayout使用上一直都很有困难
: 现在是用StoryBoard拉Autolayout
: 画面上有一个 "searchBar" 跟 "tableView" 排列方式如图
: http://i.imgur.com/RrlzpSr.png
: searchBar的constraint是Bottom Space to tableView, 距离0
: tableView的constraint是Top Space to tableView, 距离0
: 另外也有Leading space 跟 Trailing Space to Superview, 距离也都是0
: 现在有个需求, 有某个状况会要把searchBar从画面中移除(removeFromSuperView)
: 而我想要在searchBar移除之后让tableView的Top Space to Superview 是 0
: 简单的说就是searchBar移除之后, tableView要往上递补..
: 不过一直试不出来, 也不知道constraint怎么设比较好
: 不知道searchBar移除之后, 该怎么让autolayout知道我想重新layout @@
: 麻烦一下各位高手了 谢谢
设一个让tableView的top跟superview的bottuom距离为0的constraint即可
^^^^我写错了,是top
[self.view addConstraints:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[tableView]"
options:0
metrics:nil
views:@{@"tableView": _tableView}]];
我写了一个简单的Demo
https://github.com/WhiteFur/AutolayoutPractice
作者:
kiii210
(HelloWorld!)
2014-02-12 12:25:00
感谢您,成功了,我之前也是这样想...但不是用visualFormat我这样写:
http://goo.gl/hN2Fa7,意思应该一样呀?
怎么会这个就不成功..疑惑..谢谢...我以为是要跟superview的bottom对齐=_=tableview上面跟superview的下面距离是0^以为是
继续阅读
[问题] 关于touch event
ef1231
Re: [问题] Applescript utf8 之问题
uranusjr
Re: [问题] 存取相簿的问题
darktt
[问题] 能够侦测手写输入吗?
GoodTauSo
[问题] Applescript utf8 之问题
KORAS
[问题] app网站同步疑问
haves560
Re: [问题] 请问 IPC - 更改需求至 tcp/ip ; Object C 与 Xcode
HuangJC
[问题] 存取相簿的问题
LonelyLouis
Re: [分享] 给平常也会看 AmiAmi 小人网站的朋友
tomjpsun
[问题] 同网域下传档案
issuemylove
Links
booklink
Contact Us: admin [ a t ] ucptt.com