I have a UIImageView which I placed in interface builder and set to a custom class I have created SASImageView
. However, when the view is loaded I want to do some setup so I have placed code in awakFromNib
however, this does not seem to be called.
- (void)awakeFromNib {
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTapGesture:)];
tap.numberOfTapsRequired = 1;
[self addGestureRecognizer:tap];
}
How would I do some setup for this view in code, after its been loaded from interface builder?
Thanks.
This is something you can easily put in the
initWithCoder:
method since you're loading from an XIB file:Sidenote: Setting
numberOfTapsRequired
to1
is unnecessary, as that's the default.