ios - Can't set frame of a UIView while it's a child of UIScrollView -


i have created 1 uiview inside uiscrollview storyboard.

enter image description here

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!

enter image description here

my code: enter image description here

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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -