At the moment I have a UIViewController subclass with a UIScrollView and a UIView inside of it. Below is a snippet of code from the class:
.h
#import <UIKit/UIKit.h>
@interface Scroller : UIViewController <UIScrollViewDelegate>
{
UIScrollView *scrollView;
UIView *testView;
}
@property (retain, nonatomic) IBOutlet UIScrollView *scrollView;
@property (retain, nonatomic) IBOutlet UIView *testView;
@end
Inside the IB I link the UIScrollview to my variable, but when I get to the .m and try setting my scrollview contentSize it shows the scrollView as being nil.
.m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
// Initialize of scrollView
scrollView.contentSize = CGSizeMake(500, 500);
scrollView.delegate = self;
}
Am I missing an import or anything to get this to be properly allocated?
Edit
It may help to know, but if I try to debug the issue and in the lldb check the value of scrollView I get a EXC_BAD_ACCESS error if I try to continue in the code.
The issue wasn’t related to the code, but the debugger itself. I tried doing this in xCode 4.3.1 and was debugging through the application and saw that the proper fields weren’t being set both in the xib and in the code. I deleted everything and opened up xCode 4.2 and tried in there and everything worked nicely. After testing in 4.2 I moved to 4.3.1 where it asked me to switch from the GDB to the LLDB. I guess it was just paranoia on my end for not seeing proper results showing up.