ios - How to change a label on one UIView from another UIView -
within iphone app have 2 uicontrols viewcontroller.h , selectionscreen.h.
the selectionscreen set so
@interface selectionscreen : viewcontroller{
i trying change label placed in main viewcontroller, selectionscreen
so far have within selectionscreen.m (persontotal1.text label in other uicontrol)
- (ibaction)change:(id)sender{ int x=123; nsstring *y =[nsstring stringwithformat:@"%i",x]; persontotal1.text=y; nslog(@"%@",persontotal1.text); }
when nslog check if value has changed returns null, how can make interactions(such button press) within selectionscreen change label text in screen.
in view controller:
did set persontotal1 ivar property? setting ivar not enough:
uilabel *persontotal1;
you need set property , synthesize getters , setters so:
@property(nonatomic, retain) uilabel *persontotal1;
if using arc so:
@property(nonatomic, strong) uilabel *persontotal1;
then sure synthesize label. import viewcontroller.h selectionscreen file. there can access uilabel properties. hope helps, if not let me know , can clarify.
Comments
Post a Comment