我是一个为 iPhone 制作简单的签名捕获应用程序的菜鸟。
该应用程序假设让用户导航到填充有交付的表视图。然后,他们将单击他们当前正在交付的交付。
我在EXC_BAD_ACCESS
尝试加载表格视图时遇到了一个错误,所以我运行了 Zombie Diagnostic Instrument 来查看是否能找到问题所在。我收到了 Zombie 错误,但是没有一个“负责任的调用者”引用了我编写的任何代码。
所以到目前为止,我的应用程序的基本流程是我有一个视图,上面有 3 个按钮,其中一个指向表格视图,然后如果你使用它就会崩溃。
这是视图开关的代码:
-(IBAction) deliveriesButtonClicked:(id)sender {
if (self.deliveriesViewer == nil) {
DeliveriesViewerController *aOptionController = [[DeliveriesViewerController alloc] initWithNibName: @"DeliveriesViewerController" bundle: nil];
self.deliveriesViewer = aOptionController;
[aOptionController release];
}
[self.mainNavigationController.view removeFromSuperview];
[self.view insertSubview:self.deliveriesViewer.view atIndex:0];
}
这是它正在切换到的交付类的代码
标题:
#import < UIKit/UIKit.h >
@interface DeliveriesViewerController : UITableViewController <UITableViewDelegate> {
IBOutlet UITableView *myTable;
}
@property (nonatomic, retain) UITableView *myTable;
@end
执行:
#import "DeliveriesViewerController.h"
#import "AppDelegate.h"
@implementation DeliveriesViewerController
@synthesize myTable;
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
- (void)viewDidUnload {
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
return appDelegate.invoices.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:MyIdentifier] autorelease];
}
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
cell.text = [appDelegate.invoices objectAtIndex:indexPath.row];
return cell;
}
@end
如果有人可以帮助我找到这个问题,将不胜感激。