swift - CGrect vs constrains in IOS pro programmatical GUI Design? -
we use cgrect
inside frame specifying width, height , exact coordination of rectangle (shape).
do need specify constrains ui elements 1 one well? if yes, why need to? how device rotation (portrait vs. landscape mode)? need define different positioning?
if defining constraints not have specify cgrect frame design. in fact best way use nslayoutconstraints. reason if set cgrect frame, when device rotating of time cgrect can wrong. @ least hight , with. if use constraints when device rotating layout subviews again automatically. means views rearrange according constraints.
when set cgrect frame is, changes view's position , dimensions regardless of constraints. if try call view.layoutifneeded()
or change orientation views rearranged according constraints regardless frame set before.
Comments
Post a Comment