dequeueReusableCellWithIdentifier always return non nil?

前端 未结 2 1929
灰色年华
灰色年华 2021-01-06 19:54

In the classic pattern below the returned cell from dequeueReusableCellWithIdentifier is always non nil. Why? Shouldn\'t we have to al

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-06 20:38

    If you're using storyboard and set the UITableViewCell's Identifier to the identifier to the one you are using in dequeueReusableCellWithIdentifier ("AlbumCell" in your case) in the storyboard file, the UITableView will always create cells for you. I guess this is a feature of storyboard. If the identifier can't be found in your storyboard, then you need to create cells manually.

提交回复
热议问题