Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UIViewController中的UITableView,数据源有问题吗?_Uitableview_Uiviewcontroller - Fatal编程技术网

UIViewController中的UITableView,数据源有问题吗?

UIViewController中的UITableView,数据源有问题吗?,uitableview,uiviewcontroller,Uitableview,Uiviewcontroller,我有这个: @interface HomePage : UIViewController<UITableViewDelegate, UITableViewDataSource> { UITableView *myTable; NSMutableArray *data; } @property (nonatomic, retain) IBOutlet UITableView *myTaböe; @property (nonatomic, retain) NSMutable *dat

我有这个:

@interface HomePage : UIViewController<UITableViewDelegate, UITableViewDataSource> {
 UITableView *myTable;
 NSMutableArray *data;
}
@property (nonatomic, retain) IBOutlet UITableView *myTaböe;
@property (nonatomic, retain) NSMutable *data;

但什么也没发生。。。。。为什么?

我猜这是因为您正在更新
tv
表,而您的视图实际上显示了
myTable
。我看不到代码的相关部分,但请确保您的UIView实际使用正确的表

此外,如果这样做毫无意义,请尝试在某处添加[myTable reloadData]或[tv reloadData]。但我认为问题在第一段-如果这不起作用,我不明白为什么这应该

int i= 0;
    while(barfoo is true){
      [data insertObject:r atIndex:i];
      NSArray *insertIndexPaths = [NSArray arrayWithObjects:[NSIndexPath indexPathForRow:i  inSection:0],nil];
      UITableView *tv = (UITableView *)self.myTable;
      [tv beginUpdates];
      [tv insertRowsAtIndexPaths:insertIndexPaths   withRowAnimation:UITableViewRowAnimationRight];
      [tv endUpdates];
    i++;
    }