1
我在storyboard
的ViewController視圖(父視圖)中放置了UIView
(子視圖)。
我正在使用AutoLayout。
當我運行iPhone3.5" 設備上的應用程序,父視圖的高度是480,但子視圖的身高是568 我怎樣才能設置子視圖的高度一樣使用AutoLayout
?iPhone如何使用自動佈局使子視圖高度與父視圖高度相同
家長的高度關注中是什麼我嘗試過,但沒有效果。
1)在故事板 「高度相等」 約束被禁用。
2)我把代碼中的ViewController的viewDidLoad
。
NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:myView
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:self.view
attribute:NSLayoutAttributeHeight
multiplier:1.0
constant:0];
[self.view addConstraint:constraint];
我試圖使用故事板和代碼添加4個約束,但子視圖的高度總是568在iPhone3.5「device。 – imfromMO
什麼是您的父視圖?是否可能是滾動視圖? –
父視圖和子視圖是UIView – imfromMO