當我運行我的應用程序我得到這個錯誤:NSInvalidArgumentException:無法識別的選擇發送到實例
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-
[UIRoundedRectButton copyWithZone:]: unrecognized selector sent to instance
0xcc86970'
爲什麼我得到這樣的錯誤?我小心地檢查IBOutlets和IBAction的所有連接。這是我的代碼:
MenuViewController.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];
}
感謝
謝謝非常 –