so far I have done most view programming in code, but it really is cumbersome to position buttons perfectly in code. I searched for some time, maybe I’m using the wrong words for my search? Anyway, I created a UI in a nib file, it has several buttons. I loaded the .nib file into my view like this:
NSArray* nibViews = [[NSBundle mainBundle] loadNibNamed:@"UCMenuView" owner:self options:nil];
UIView *menuView = [nibViews objectAtIndex:0];
self.delegate = (id<UCMapviewDelegate>)delegate;
// another controller does the view switching, so I'm sending him the view
[self.delegate pushView:menuView];
This is ‘fine’. But I don’t understand how I get a pointer to my buttons. I know about IBOutlet, but how do I connect them to the elements in the .nib? How would I connect this @property (strong, nonatomic) IBOutlet UIButton *calendar;
to a specific button in the .nib?
I tried to ctrl-drag (from that little points on the left side of the @property, but that does not work (from neither side). Excuse me if this is an easy question, but I couldn’t find a clear explanation
thanks for your help
UIView *menuView, you need to create a customUIView subclass for that, e.g.
UCMenuView. Define your properties on this customclass.
the left column and set its Custom Class in the identity
inspector to
UCMenuView.your IBOutlets.