I have an UIViewController class with two labels and a UIImageView set as IBOutlets, and I have this outlets connected in my xib, I have double checked they are connected properly, however when I check the their value in the debugger they are 0x0 so I cant change them programatically. Any ideas on what I might be doing wrong.
Heres the header file of my code:
#import <UIKit/UIKit.h>
@interface PlateDetailViewController : UIViewController {
IBOutlet UIImageView *image;
IBOutlet UILabel *price;
IBOutlet UILabel *description;
}
@property (nonatomic, retain)IBOutlet UIImageView *image;
@property (nonatomic, retain)IBOutlet UILabel *price;
@property (nonatomic, retain)IBOutlet UILabel *description;
@end
Your outlets won't get set until the view controller's view is actually instantiated, which in your case is probably happening shortly after initWithNibName:bundle:
—at which point they'll still be nil. Any setup you do that involves those outlets should be happening in your view controller's -viewDidLoad
method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With