2011-03-21 61 views
1

我是Sirisha。我是iPhone新手。我想在表格视图中显示多行(例如:一个10,两个15等)请帮助我。如何在UITableView中显示多行

+1

1个部分返回3行我想你指的是“多列” ... – Lukman 2011-03-21 05:27:46

回答

2

ü可以通过使用表中的节执行此第一部分包含10个第二部分包含15

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
return 2;  //one section in the table. 
} 

,然后使用此方法来添加的行数

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
     //number of rows in the section 

如果则第1 返回10 如果第2部分 返回15

+0

你可以开始使用的UITableView的示例代码。 http://www.iphonesdkarticles.com/2009/03/uitableview-drill-down-table-view.html http://adeem.me/blog/2009/05/19/iphone-programming-tutorial-part-1 -uitableview-using-nsarray/ – Jhaliya 2011-03-21 05:40:45

+0

谢谢你,我会试试 – sirisha 2011-03-21 05:46:53

0

在视图中,load load应该为行数组分配一个数组 rowArray = [NSArray alloc] initWithObjects:@“A”,@“B”,@“C”,nil];

  • (NSInteger的)numberOfSectionsInTableView:(UITableView的*)的tableView {

    返回1; }

  • (NSInteger的)的tableView:(UITableView的*)的tableView numberOfRowsInSection:(NSInteger的)部分{ 返回[rowArray计数];

}

它会在表视图