I have set up an UIScrollView with an UIView (contentViewForScroll) to hold all the content, as indicated in http://spin.atomicobject.com/2014/03/05/uiscrollview-autolayout-ios/ , IB is not showing any warning about misplacing, expected widths, and so on....
But when I tried to add programmatically the constraints to set the width of the "contentViewForScroll" on viewDidLoad, I got a weird error description, after google it I found it means your object's property is returning "nil". That's exactly what was happening!! Then I realized that I have an UILabel not changing its value when I modified its property. The other UILabels and UIButtons changed their text and title properties as expected.
I have tried renaming both controls (that is why it has such a long name), changing definition in .h file or in .m file. Nothing works.
¿any ideas?
This is my code in .m file:
@interface MarketsViewController ()
@property (strong, nonatomic) IBOutlet UILabel *labelMarketName; // This is returning nil
@property (strong, nonatomic) IBOutlet UIImageView *imageVenueCover;
@property (strong, nonatomic) IBOutlet UILabel *labelMarketAddress;
@property (strong, nonatomic) IBOutlet UILabel *labelMarketCity;
@property (strong, nonatomic) IBOutlet UIView *contentViewForScroll; // This is returning nil
@end
@implementation MarketsViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"UIView: %@", self.contentViewForScroll); // this is returning "UIView: (null)"
NSLog(@"UILabel: %@", self.labelMarketName); // this is returning "UILabel: (null)"
}
@end
Thanks