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

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -