我正在學習如何在iOS中使用UITableView和UITableViewController,我想我可能會迷惑自己。我創建了一個簡單的TableView,我有2個部分。沒什麼複雜。瞭解UITableView和UITableViewController中的代表
我有以下的定義,它精細的構造:
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
// Section is going to be either 0 or 1, high or low
if (section == 0) {
return 1;
}
else {
return 2;
}
}
但是我不明白的是方法的定義。兩種方法都必須返回一個整數,所以我理解起始(NSInteger)。 numberOfRowsInSection開始於tableView:(UITableView *)tableView我不明白爲什麼?
我是新來的編程iOS所以要溫柔:-)所有幫助非常感謝。
邁克
感謝您的所有意見。 – hydev 2011-01-20 14:25:51