ios - Access properties from UIView subclass -
i have pretty cluttered display need textfield, 9 uilabels , 9 uibuttons lines connecting them in inverted-tree shape. created on code.
in order tiddy uiviewcontroller display code such constraints , display-realted, i've created subclass of uiview. inside subclass of uiview i've created labels , buttons public properties.
on storyboard changed class of self.view new subclass created. when run simulator displays correctly wanted.
the problem comes when try access public properties of subclass i've created, instance when try change label's text. when type on viewcontroller xcode doesn't show properties i've set previously.
now don't know if approach straight-on wrong or if i'm missing something. better create subclass of uiviewcontroller , work on there?
any appreciated greatly.
override view
property in interface extension:
#import "customview.h" @interface viewcontroller () @property (nonatomic, strong) customview *view; @end @implementation viewcontroller // needed if you're not using storyboards -(void)loadview { self.view = [customview new]; // setup rest of view, e.g. self.view.customlabel.text = @"custom label text"; } @end
edit: i've noticed using storyboards, loadview
isn't needed, i've left in completeness others
Comments
Post a Comment