I have a View (called MyView) in my Layout file. I want to content to be loaded from another XIB file (called FooterView). This works fine, this way:
NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"FooterView" owner:self options:nil];
UIView *footerView = [subviewArray objectAtIndex:0];
[MyView addSubview:footerView];
But what if I have a button in my FooterView, with the Touch Up Inside linked to a IBAction in my FooterView.m class?
At the moment, when I click on the button, I’m receiving this error:
unrecognized selector sent to instance
It would be great if I can catch the button click in the FooterView.m class.
How can I get this done?
Edit: I now have the following problem: I want to change the view from My FooterView class (which inherits from UIView) like this:
NewView.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:distilleryView animated:YES];
Where NewView is a UIViewController. I can’t call presentModalViewController from a View. I also tried getting the parentclass from self, but that doesn’t work either.
How can I make this work?
Have you tried to set the file’s owner to
FooterView in xib like this one