ios - How to access custom view properties after initialize -


i'm targeting ios 8+.

i have form used in more 1 place. decided create custom view define various "form" text fields.

i have built xib, , uiview subclass contains outlets each textfield.

the view composed of background image , scroll form fields on it.

now, first obstacle was: need have custom view in container may or may not have navigation bar. made me create constraint outlet update value push down scroller view. way i'd have whole image in frame, top being behind navbar , scroller bellow nav bar).

here's manual drawing understanding problem. enter image description here

it's possible i'm making lot of mess , confusion on way solve this. :)

the problem is:

after awakefromnib runs have no access constraint property. noticed same thing happens textfields outlets.

so, how can access custom view's properties when instantiate them programatically?

something like:

controller:

let customview = signupview(frame: f) view.addsubview(customview) customview.pushscrollerdownby(50.0) 

custom view:

func pushscrollerdownby(yoffset: cgfloat) {     //topscrollerconstraint outlet textfield.     topscrollerconstraint.constant = yoffset //right topscrollerconstraint nil.  } 

you should check if have connected topscrollerconstraint file's owner since not instantiated , therefore, error. here recent question regarding difference between these two:

what file’s owner in xib in case?


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -