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++;
}