- (void)viewDidLoad {
NSArray *array = [[NSArray alloc]initWithObjects:@"Pictures",@"Video",@"Text",@"Map",nil];
self.selectionList = array;
[array release];
[super viewDidLoad];
}
...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [selectionList objectAtIndex:row];
return cell;
}
私の質問はこれです、なぜのviewDidLoad]セクションで、それだけでselectionList self.selectionListなくする必要がありません?つまり、私たちが作成した配列の内容をselectionList配列に渡すのがポイントです。それでなぜ自己ですか?
プロパティとObjective-Cメモリ管理を読む – nduplessis
サイドノート: 'viewDidLoad'は最初に(最初の行として)親呼び出しを持つ必要があります。 –
@ケビン:違いはしないでください。アップルのドキュメントでは、それはまったくまったく呼ばれません。 – Eiko