[Getting Started with iOS] The difference between dequeueReusableCellWithIdentifier: and dequeueReusableCellWithIdentifier: forIndexPath:

The difference between dequeueReusableCellWithIdentifier: and dequeueReusableCellWithIdentifier: forIndexPath: !!

  • If you have registered a Cell, the former will return nil when no cell is available; the latter will always create an available Cell for you from the registered nib or class. In other words, the former calls you need to manually check nil, while the latter does not need;
  • If you have never registered a cell, when there is no cell available, the former will return nil, the latter ... directly crash! In other words, calling the latter you must make sure that registered the Cell .



Guess you like

Origin www.cnblogs.com/mamamia/p/12711126.html