iphone - 应用程序在设备上崩溃,但在模拟器中推送 UITableView 时不会崩溃

标签 iphone ios xcode uitableview push

这是我第一次在这里写文章,但我有一个无法处理的问题:(...

当我在另一个表中推送单元格后推送 UITableView 时,问题就出现了,如果我创建一个通用 UITableViewController 并推送它,则可以工作,但如果我使用所有必要的方法重新定义类,则不起作用。

我之前在其他代码中实现过这个并且它可以工作,但是现在,更新到 Xcode 4.5 后,不起作用......

这是我要推送的 View 的源代码:

@interface ECDetailSettingsTableView ()

@end

@implementation ECDetailSettingsTableView

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return 4;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"ECDetailSettingsCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    if (cell == nil) cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ECDetailSettingsCell"];

    // Configure the cell...

    return cell;
}

这是推送 tableview 的代码:

/********************* Pushing View *********************/
[tableView deselectRowAtIndexPath:indexPath animated: YES];

_themeTable = [self.storyboard instantiateViewControllerWithIdentifier:@"ECDetailSettingsViewController"];
[self.navigationController pushViewController:_themeTable animated:YES];

PD:谢谢大家,如果我犯了语法错误,很抱歉:)。

最佳答案

也许如果您在 Storyboard 中使用 segue 会生成错误,因为这仅适用于 iOS 6。

关于iphone - 应用程序在设备上崩溃,但在模拟器中推送 UITableView 时不会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12983299/

相关文章:

ios - 此 iPhone 7(型号 1660、1778、1779、1780)运行的是 iOS 12.3.1 (16F203),此版本的 Xcode 可能不支持

iphone - Apple 是否允许自定义版本的自己的系统字体?

ios - Build 1.0.0 不包含正确的测试版权利。有关详细信息,请参阅 iTunes Connect 开发人员指南

iphone - 如何在 iPhone 上使用 ARMv6 优化的 OpenMAX DL 库

ios - 在 objective-c 文件中有一个按钮(来自 pod)并从 swift 中继承它

ios - MKMapview 改变标注图片

iphone - 点击其他链接时 UIWebView 滚动到顶部

asp.net - MonoTouch 和 .NET 上的 TimeZoneInfo 不匹配

ios - 如何在swift中重载赋值运算符

ios - info.plist 中的奇怪文本正确的文本应该是什么