Does DequeueReusableCellWithIdentifier always return non nil?

In the classic template below, the return cellfrom is dequeueReusableCellWithIdentifieralways not nil. What for? Shouldn't we first select a cell, and then we have the possibility of reuse?

I am using a custom cell and it was created in a storyboard. (However, if I used the UITableViewCell by default, the phenomena are the same - the returned cell is still always non-nil).

Enviroment: Xcode 4.3.3 iOs 5.1

AlbumListCell *cell = [tableView dequeueReusableCellWithIdentifier:@"AlbumCell"];

//cell always non nil --- why??
if(cell == nil){
    cell = [[AlbumListCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"AlbumCell"];

}
+3
source share
2 answers

UITableViewCell , dequeueReusableCellWithIdentifier ( "AlbumCell" ) , UITableView . , . , .

+6

, , . , , , . , , , , , , aloc init . , , xcode, , , , .

, iTunes iPad iPhone - Paul Hegarty - Stanford CS193p. (25) 9. 26 .

0

All Articles