在我当前的视图中,按钮 touch-up-inside 事件会导致以下操作:
(请注意,在调试器中,我已经验证了[self navigationController]和实例化的historyViewController确实存在。
我无法确定为什么会发生这种不良访问。我可以从导航控制器弹出/推送此视图/其他视图。关于如何着手调查为什么这个视图在被推到导航控制器时会出现问题的任何想法?
-(IBAction) viewOrEditHistory: (id) sender {
HistoryViewController *historyViewController = [[HistoryViewController alloc] initWithStyle:UITableViewStyleGrouped];
historyViewController.title = @"View or Edit by date";
historyViewController.sameExSessions = [[NSMutableArray alloc] init];
historyViewController.exercise = [[Exercise alloc] initWithName:self.title muscleGroup:muscleGroupLabel.text];
/*** EXC_BAD_ACCESS happens after following line is executed ***/
[[self navigationController] pushViewController:historyViewController animated:YES];
}
这是我的 HistoryViewController.h
#import
@interface HistoryViewController : UITableViewController {
NSMutableArray *sameExSessions;
Exercise *exercise;
}
@property (nonatomic, retain) NSMutableArray *sameExSessions;
@property (nonatomic, retain) Exercise *exercise;
-(NSMutableArray *) SameExerciseSessionList;
-(NSString *) getDocPath;
-(NSInteger) tableView:(UITableView *) tableView numberOfRowsInSection: (NSInteger)section;
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath;
@end