Apple introduced the item's estimated line height feature in iOS8.0 to accommodate the size of the dynamic calculation item:
@property (nonatomic) cgsize estimateditemsize ns_available_ios(8_0); //defaults to cgsizezero-setting a Non-zero size enables cells that self-size Via-preferredlayoutattributesfittin Gattributes:
use Estimateditemsize to implement-preferredlayoutattributesfittingattributes in custom item : method Dynamically calculates the size of item.
Tested under the 8.1,8.2 system, if the project is integrated with other third-party SDKs, using this method will only appear Libc++abi.dylib:terminate_handler unexpectedly threw an exception error, Global breakpoint cannot be located in the wrong place, if no third-party SDK is used, this error will be reported
Rewrite the pipelining layout, rewrite the layoutattributesforelementsinrect: method, print the returned layout properties, find that it is empty, find the reason, is in the 8.1,8.2 system, use the estimated row height, the custom item in the - Preferredlayoutattributesfittingattributes: It is not called, this could be a bug in the system.
ios8.x Uicollectionview Using item's Estimated row height problem