The reason why I need a global IBOutlet variable is because, I don't want to lose data after you switch view back. for example, I have an IBOutlet
and UIlabel
and set its text.
@property (retain, nonatomic) IBOutlet UIImageView *imageView;
@property (retain, nonatomic) IBOutlet UITextField *inputText;
@property (retain, nonatomic) IBOutlet UILabel *warnningLabel;
After I switch back from the other view, UILabel will be set to nil, which I don't want it happen. Any ideas?
Try this:
save the value using NSUserDefaults (or declare a global NSString variable) on viewDidDisappear and set UILabel.text on viewDidAppear