代码之家  ›  专栏  ›  技术社区  ›  Omer

UITableView后台自定义奇怪的行为

  •  1
  • Omer  · 技术社区  · 14 年前

    我的控制器是UITableViewController的一个子类,我只是写了以下几行

    UIImage *image = [UIImage imageNamed:@"home-portrait-iphone.png"];
    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
    self.tableView.backgroundView = imageView;
    

    在模拟器上一切看起来都很棒,我的意思是,我看到我的桌子,作为背景视图,y可以看到图像。但当应用程序在设备(ipod touch)上运行时,我会遇到以下错误:

    程序接收信号:SIGABRT。

    堆栈上写着:

    由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“***-[UITableView setBackgroundView:]:无法识别的选择器发送到实例0x812e00”

    在赋值中抛出了一个异常,表示这行:

    self.tableView.backgroundView = imageView;
    

    有什么想法吗?

    2 回复  |  直到 14 年前
        1
  •  2
  •   Ole Begemann    14 年前

    这个 backgroundView

        2
  •  1
  •   Noah Witherspoon    14 年前

    这个 backgroundView 财产 UITableView