我有AViewController和BViewController。当我在AViewController中添加BViewController作为subView并且BViewController有一个按钮时。在这个时候BViewController按钮不起作用。
AViewController.m
UIStoryboard *sb = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
BViewController bViewController = [sb instantiateViewControllerWithIdentifier:@"BViewController"];
[self.view addSubview:bViewController.view];
[self.view bringSubviewToFront:bViewController.view];
BViewController.m
#import "BViewController"
@interface BViewController ()
@end
@implementation BViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)buttonAction:(id)sender {
// here buttonAction not working
[self.view removeFromSuperview];
}
@end
这里ButtonAction不起作用。谢谢你的帮助。