objective c - iOS auto layout: how to design different layouts for iPad landscape and iPad portrait in Xcode storyboard? -
i new size class , auto layout in ios. practicing same through small application. below trying achieve through auto-layout , size-class. below specific screenshots ipad portrait , ipad landscape respectively.

ipad portrait:: 3 subviews here i.e. gray view, green view, pink view.
gray view- 3/4th height of super view, 2/3th width of super view green view- 3/4th height of super view, 1/3th width of super view pink view- 1/4th height of super view, same width super view
ipad landscape:: same 3 subviews ipad portrait @ different positions.
gray view- same height super view, 2/4th width of super view green view- same height super view, 1/4th width of super view pink view- same height super view, 1/4th width of super view
i able manage auto layout long there 2 subviews. but, unable achieve described above. also, want have different layout design in ipad portrait , landscape.
take on new adaptive interface builder: "what's new in interface builder" wwdc2014 https://developer.apple.com/videos/wwdc/2014/ , see designing different uis different screen sizes - big, small, default.
edit: let's start creating single uiview inside viewcontroller: uiview in uiviewcontroller
after select uiview , click constraints editor in lower-right corner (an "tie fighter" icon). editing constraints
select upper , left constraint 0 (untick "constrain margins"): constrains
control+drag view background view , select equal widths:equal widths
select view , on right side of panel select size inspector. have list of constrains there. select equal width to:superview , click edit. select multiplier e.g. 1/2: proportional constrain.
add additional 2 views , play constrains: adding space nearest neighbour , others want.
important step: click on w h on bottom of interface builder , select regular width|any height.[w h any first created general constrains. create more specific constrains called size-class (class representing size of screen depending on model , orientation of device). can create different set of constrains in previous description.
i wish luck.
Comments
Post a Comment