アプリケーションを実行すると、次のエラーが発生します。
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];
}
前もって感謝します