i've tried class
https://github.com/autresphere/asdepthmodal
i want popup want able set labels programmatically, since need change depending on day is. i'm using storyboard, i've created .xib , uiview.h , uiview.m. in main uiviewcontroller have:
xibcontents = [[nsbundle mainbundle] loadnibnamed:@".xib" owner:self options:nil]; testview = [xibcontents lastobject]; in .xib have set file owner uiview class, create problem: nsunknownkeyexception when set uiiew inside .xib uiview class application load , can open should, i'm not able change state of label programmatically? i'm complety lost here!
typically speaking, uiviews not have access iboutlets. apple kind of intended xibs assigned uiviewcontrollers.
however, can load view xib in 2 ways:
1) create xib use in uiviewcontroller. set file's owner view controller, , class name of view custom view class. in interface builder, under "custom class". can set view iboutlet, , ios create instance of custom class when uiviewcontroller loads xib , sets owner (like tried above, within controller class)
2) load xib in uiview class, , set self resultant object:
- (id)init { self = [super initwithframe:cgrectmake(0, 0, 1024, 352)]; if (self) { nsarray* nib = [[nsbundle mainbundle] loadnibnamed:@"tcsnumberkeypad" owner:self options:nil]; [[nib objectatindex:0] setframe:cgrectmake(0, 0, 1024, 352)]; self = [nib objectatindex:0]; } return self; } in either case, need retrieve label via code rather iboutlet properties. can find label in subviews property:
uilabel* mylabel = [self.subviews objectatindex:0];
Comments
Post a Comment