简体   繁体   English

重新加载tableView时出错

[英]Error in tableView reload

when i try to refresh my table view,that it's inside a view controller, compiler found an error. 当我尝试刷新表视图时,该视图位于视图控制器内部,编译器发现错误。 I declare my tableView in .h file and i linked it with the outlet,so why?thanks. 我在.h文件中声明tableView并将其与插座链接,为什么?谢谢。

.h 。H

@interface UfficiViewController : ViewController<UITableViewDelegate,UITableViewDataSource,UISearchDisplayDelegate,NSURLConnectionDelegate>
@property (weak,nonatomic) IBOutlet UITableView* tableViewUffici;
@end

.m .m

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {


    self.tableViewUffici.delegate = self;
    self.tableViewUffici.dataSource = self;
    //Ricarico la tableView perchè devo attendere i tempi della connessione
    [self.tableViewUffici reloadData];
}

In the storyboard, you have wired a table view to an outlet named tableView . 在情节提要中,您已将表格视图连接到名为tableView的插座。 Then in the view controller code you deleted it but you forgot to unwire it. 然后在视图控制器代码中将其删除,但忘记了取消连线。 Please note that this is not an error from the compiler. 请注意,这不是编译器的错误。 It's runtime error. 它是运行时错误。

Solution

  1. Go to the storyboard. 转到情节提要。 Click on the view controller. 单击视图控制器。
  2. Open Connections Inspector (cmd + option + 6). 打开连接检查器 (cmd +选项+ 6)。
  3. Look for a connection with name tableView . 查找名称为tableView的连接。
  4. Delete it. 删除它。

change the 改变

@property (weak,nonatomic) IBOutlet UITableView* tableViewUffici;

to

@property (nonatomic,strong) IBOutlet UITableView* tableViewUffici;

This may help you. 这可能对您有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM