Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.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
Objective c 如何使用NSMutableArray填充rootviewcontroller表视图_Objective C_Ios_Uitableview_Nsmutablearray - Fatal编程技术网

Objective c 如何使用NSMutableArray填充rootviewcontroller表视图

Objective c 如何使用NSMutableArray填充rootviewcontroller表视图,objective-c,ios,uitableview,nsmutablearray,Objective C,Ios,Uitableview,Nsmutablearray,我正试图用NSMutableArray填充tableview,但我真的很难使用它 我想这应该很简单,但我不能让它工作 任何帮助都将不胜感激 谢谢您只需创建一个实现UITableViewDataSource的对象 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.yourArray count]; } - (UITableViewC

我正试图用NSMutableArray填充tableview,但我真的很难使用它

我想这应该很简单,但我不能让它工作

任何帮助都将不胜感激


谢谢

您只需创建一个实现UITableViewDataSource的对象

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.yourArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    /* create your cell here */

    AnObjectFromYourArray *myObject = [self.yourArray objectAtIndex:[indexPath row];

    /* fill the cell with the info in my object */

    return yourCell;
}
就这么简单


Greg

您只需创建一个实现UITableViewDataSource的对象

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return [self.yourArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    /* create your cell here */

    AnObjectFromYourArray *myObject = [self.yourArray objectAtIndex:[indexPath row];

    /* fill the cell with the info in my object */

    return yourCell;
}
就这么简单


Greg

网上有很多教程,甚至有关于创建简单表视图的StackOverflow教程。你应该四处搜索一下!这是谷歌的第一个成功案例:网络上有很多教程,甚至还有创建简单表视图的StackOverflow。你应该四处搜索一下!以下是谷歌的第一个成功案例: