当我运行我的应用程序时,我收到此错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-
[UIRoundedRectButton copyWithZone:]: unrecognized selector sent to instance
0xcc86970'
为什么我会收到这样的错误?我仔细检查了 IBOutlets 和所有 IBAction 的所有连接。这是我的代码:
菜单视图控制器.h
@interface MenuViewController : UIViewController
<UITableViewDelegate, UITableViewDataSource>{
}
@property (nonatomic, copy) IBOutlet UITableView * tableView;
@property (nonatomic,copy) IBOutlet UILabel *labelTitle;
@property (nonatomic, copy) IBOutlet UIButton *buttonHome;
@property (nonatomic, copy) IBOutlet UIButton *buttonMap;
@property (nonatomic, copy) IBOutlet UIButton *buttonFavorites;
-(IBAction) pressedHome:(id)sender;
-(IBAction) pressedMap: (id)sender;
-(IBAction) pressedFavorites: (id)sender;
@end
在 MenuViewController.m
-(IBAction) pressedHome:(id)sender{
MenuViewController * menu =[[MenuViewController alloc]initWithNibName:@"MenuViewController" bundle:nil];
[self.navigationController pushViewController:menu animated:YES];
}
-(IBAction) pressedMap: (id)sender{
MapViewController * map =[[MapViewController alloc]initWithNibName:@"MapViewController" bundle:nil];
[self.navigationController pushViewController:map animated:YES];
}
-(IBAction) pressedFavorites: (id)sender{
FavoritesViewController * favorites =[[FavoritesViewController alloc]initWithNibName:@"FavoritesViewController" bundle:nil];
[self.navigationController pushViewController:favorites animated:YES];
}
提前致谢