I am trying to figure out all the different ways to create a view and am having problems with dragging it out from the object library when I have a custom xib.
This is what I have in my UIView:
-(id)initWithCoder:(NSCoder *)aDecoder{
self=[super initWithCoder:aDecoder];
if (self) {
}
NSLog(@"about to return here");
return self;
}
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
UIView *myView=[[[NSBundle mainBundle] loadNibNamed:@"testview" owner:nil options:nil] lastObject];
[self addSubview:myView];
}
return self;
}
// drawRect is commented out
I am able to drag out a custom view if I override drawRect but am unable to do this if I drag it out from the Object Library and update the Custom Class in the Identity Inspector.
I know I am doing something really naive but I can't believe I can't get this to work. Any ideas on how to be able to drag out a generic view to a storyboard controller and update the Custom Class and have it work?
edit #1
here's a screenshot. It is trying to draw something but it's like it doesn't know what to draw. I've added a couple of setNeedsDisplay but with no success. The main view's background is light blue and the custom view should be green. The white lines up with where this custom view should be.