ios - Autolayout: Incorrect Width when using ScrollView -
i´m using autolayout , followed instruction guide:
http://www.g8production.com/post/57513133020/auto-layout-with-uiscrollview-how-to-use
i build view xib file , interface builder. tree:
-uiview
--uiscrollview
---uiview (contentview)
----subviews
the problem when put one! subview (an uiimageview) inside contentview , set left,top , right constraint subview, warning says: autolayout expected width of 1000!! have no idea why gets broken. views have width of 320px couldn´t problem. here screenshots may help:
the uiimageview.image.size.width
1000 in case. it's following it's own intrinsic content size , expanding respect own intrinsic content size. can follow 1 of method solve this:
method 1:- add width
constraint of contentview, uiimageview adopt width of contentview.
method 2:- add width
constraint of uiimageview, contentview adopt width of uiimageview.
method 3:- add equal width
constraint on contentview , uiscrollview. contentview adopt scrollview width, , uiimageview adopt contentview width.
you can more details here contents intrinsic content size
: http://www.raywenderlich.com/20881/beginning-auto-layout-part-1-of-2
Comments
Post a Comment