ios - Can't set frame of a UIView while it's a child of UIScrollView -
i have created 1 uiview inside uiscrollview storyboard.
i want set frame uiview programatically. have tried set frame using setframe function programatically, its not working uiview inside uiscrollview.
if create 1 uiview inside uiscrollview using [[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 110)],and change size of view,it work!
my code:
but want create uiview ib , set frame using setframe function.
most impornatant condition autolayout "true".
most impornatant condition autolayout "true".
if want mix constraints setting view's frame directly, need make sure set view.translatesautoresizingmaskintoconstraints = yes
view. afaik, cannot done in ib ios, in code.
also beware setting translatesautoresizingmaskintoconstraints = yes
add new constraints define in ib (or programmatically) , have ensure remain consistent, otherwise exception. so, e.g., if set frame origin in code, pinned top distance between view , superview, run problems if specifications not compatible.
Comments
Post a Comment