iOS 上 self-sizing cell 的過去、現在、與未來
-
Upload
- -
Category
Engineering
-
view
344 -
download
2
Transcript of iOS 上 self-sizing cell 的過去、現在、與未來
![Page 1: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/1.jpg)
iOS self-sizing cell
(Jeff Lin)
![Page 2: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/2.jpg)
• Yahoo AppDevKit - - (Anistar)
• https://github.com/yahoo/AppDevKit
• – iOS BDD - (qcl)
• https://github.com/qcl/zizhi
![Page 3: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/3.jpg)
About me• YAHOO App Engineer
• iOS App
• AppDevKit
![Page 4: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/4.jpg)
Agenda
• Self-sizing
• Self-sizing
• Xcode 8
![Page 5: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/5.jpg)
Self-sizing
![Page 6: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/6.jpg)
![Page 7: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/7.jpg)
![Page 8: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/8.jpg)
/
![Page 9: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/9.jpg)
/
![Page 10: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/10.jpg)
Expandable cell
![Page 11: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/11.jpg)
• iOS dynamic type
• UIFont.preferredFontForTextStyle:
![Page 12: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/12.jpg)
![Page 13: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/13.jpg)
•
• UIImageView, UILabel, UITextView…
• Container
• UITableView, UICollectionView
•
• storyboard, xib, constraint
![Page 14: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/14.jpg)
Layout
![Page 15: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/15.jpg)
Self-sizing ?
![Page 16: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/16.jpg)
!• auto self-sizing
![Page 17: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/17.jpg)
• NSString
• sizeWithAttributes
• boundingRectWithSize:options:attributes:context:
• UILabel
• sizeToFit:
• UIScrollView/UITextView
• contentSize
![Page 18: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/18.jpg)
• size ceil()
• sizeToFit: frameconstraint
![Page 19: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/19.jpg)
UITextView contentSize
• sizeForItemAtIndexPath:
• textView.ContentSize
![Page 20: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/20.jpg)
iOS ?
![Page 21: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/21.jpg)
UITableview self sizing
• UILabel numberOfLines = 0
• AutoLayout
self.tableView?.rowHeight = UITableViewAutomaticDimension self.tableView?.estimatedRowHeight = 100
![Page 22: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/22.jpg)
That’s all!
![Page 23: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/23.jpg)
UITableview self sizing
•
• layout
![Page 24: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/24.jpg)
UICollectionView
• Grid view,
• /layout
•
![Page 25: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/25.jpg)
UICollectionView self-sizing
![Page 26: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/26.jpg)
AppDevKit• UICollectionViewCell
• subclass ADKTableViewDynamicSizeCell/ADKCollectionViewDynamicSizeCell
• constraint
• collectionView:layout:sizeForItemAtIndexPath:
• ADKNibCacheManager cell
• cell
![Page 27: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/27.jpg)
AppDevKit Solution
![Page 28: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/28.jpg)
AppDevKit Solution
collectionView:layout:sizeForItemAtIndexPath:
1. cell
let appName = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as! String? let cell = ADKSWNibCacheManager.sharedInstance().instance( className: appName?.appending(".\(SSSmallCardCollectionViewCell.self)")) as! SSSmallCardCollectionViewCell
![Page 29: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/29.jpg)
AppDevKit Solution
2.
let preferSize = CGSize.init(width: collectionView.frame.size.width / 2.0 - 10, height: 100.0) cell.frame = CGRect.init(origin: .zero, size: preferSize)
3. layoutIfNeeded constraint
cell.contentView.layoutIfNeeded()
![Page 30: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/30.jpg)
AppDevKit Solution
4.
func setup(cell: SSSmallCardCollectionViewCell, indexPath: IndexPath) { let productInfo = self.products[indexPath.row] cell.contentView.layoutIfNeeded() cell.titleLabel?.text = productInfo.productTitle ... }
![Page 31: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/31.jpg)
AppDevKit Solution
5.
let size = ADKCellDynamicSizeCalculator.sharedInstance().size(forDynamicHeightCellInstance: cell, preferredSize: preferSize)
return size
![Page 32: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/32.jpg)
Sample Code@objc(collectionView:layout:sizeForItemAtIndexPath:) func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
// 1. cell let appName = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as! String? let cell = ADKSWNibCacheManager.sharedInstance().instance(className: appName?.appending(".\(SSSmallCardCollectionViewCell.self)")) as! SSSmallCardCollectionViewCell
// 2. let preferSize = CGSize.init(width: collectionView.frame.size.width / 2.0 - 10, height: 100.0) cell.frame = CGRect.init(origin: .zero, size: preferSize)
// 3. layoutIfNeeded constraint cell.contentView.layoutIfNeeded()
// 4. setup(cell: cell, indexPath: indexPath)
// 5. let size = ADKCellDynamicSizeCalculator.sharedInstance().size(forDynamicHeightCellInstance: cell, preferredSize: CGSize.init(width: collectionView.frame.size.width / 2.0 - 10, height: 0.0)) return size }
![Page 33: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/33.jpg)
Recap1. cell
2.
3. layoutIfNeededconstraint
4.
5.
ImageView
Title
Description
Price
![Page 34: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/34.jpg)
Recap1. cell
2.
3. layoutIfNeededconstraint
4.
5.
ImageView
Title
Description
Price
![Page 35: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/35.jpg)
Recap1. cell
2.
3. layoutIfNeededconstraint
4.
5.
ImageView
Title
Description
Price
![Page 36: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/36.jpg)
Recap1. cell
2.
3. layoutIfNeededconstraint
4.
5.
ImageView
Title
Description
Price
ImageView
SO NICE
$ 790
![Page 37: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/37.jpg)
ImageView
SO NICE
790
Recap1. cell
2.
3. layoutIfNeededconstraint
4.
5.
ImageView
SO NICE
$ 790
SO NICE
,
,
$ 790
![Page 38: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/38.jpg)
AppDevKit Solution
ADKCellDynamicSizeCalculator.sharedInstance().size(forDynamicHeightCellInstance: cell, preferredSize: CGSize.init(width: collectionView.frame.size.width / 2.0 - 10, height: 0.0))
10px
![Page 39: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/39.jpg)
How AppDevKit works?•CGSize resultSize = [contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize]; resultSize.width = preferredSize.width; resultSize.height = MAX(resultSize.height, preferredSize.height);
![Page 40: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/40.jpg)
systemLayoutSizeFittingSize
• UILayoutFittingCompressedSize
• view constraints size
• UILayoutFittingExpandedSize
• view constraints size
![Page 41: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/41.jpg)
layoutIfNeeds
• layoutIfNeeds
• reloadData contentSize
• Animate autoLayout
![Page 42: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/42.jpg)
contentSize
// contentSize: {0, 0}collectionView.dataSource = self.delegator// contentSize: {0, 0}collectionView.reloadData()// contentSize: {0, 0}collectionView.layoutIfNeeded// contentSize: {375, 2557.5}
![Page 43: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/43.jpg)
layoutIfNeeds-Animation
viewForAnimate.someConstraint.constanst = 0.0 UIView.animate(withDuration: 0.3) {
viewForAnimate.layoutIfNeeded() }
UIView.animate(withDuration: 0.3) { viewForAnimate.frame = CGRect.init(origin: .zero, size: CGSize.init(width: 100, height: 100))
}
Frame base layout
Constraint Autolayout
![Page 44: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/44.jpg)
iOS ?
![Page 45: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/45.jpg)
cell
• collectionView:layout:sizeForItemAtIndexPath:
• Customized UICollectionViewLayout
![Page 46: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/46.jpg)
estimatedItemSize
![Page 47: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/47.jpg)
estimatedItemSize• iOS 8 above
• UICollectionViewFlowLayout
• estimatedItemSize
• UICollectionViewCell
• preferredLayoutAttributesFittingAttributes
![Page 48: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/48.jpg)
estimatedItemSize
• UITableView estimatedRowHeight
• UICollectionViewFlowLayoutflowLayout.estimatedItemSize = CGSize.init(width: UIScreen.main.bounds.size.width / 2 - 20, height: 100)
![Page 49: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/49.jpg)
Sample Codefunc preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { self.contentView.layoutIfNeeded() layoutAttributes.frame.size.height = systemLayoutSizeFitting(UILayoutFittingCompressedSize).height layoutAttributes.frame.size.width = self.bounds.size.width
return layoutAttributes }
![Page 50: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/50.jpg)
• class reference super.preferredLayoutAttributesFitting(layoutAttributes)
• newLayoutAttributes size 1000x1000
• iOS 10self.contentView.layoutIfNeeded()
![Page 51: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/51.jpg)
• estimatedItemSize cellpreferredLayoutAttributesFitting
• estimatedItemSize sizeForItemAtIndexPath
![Page 52: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/52.jpg)
preferredLayoutAttributesFittingAttributes
![Page 53: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/53.jpg)
preferredLayoutAttributesFittingAttributes
•
•
• + ...
![Page 54: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/54.jpg)
•constraint
• willDisplayCell
• ADKSetConstraintConstant:forAttribute: can help!
![Page 55: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/55.jpg)
• cellestimatedItemSize
flowLayout
•collectionView:layout:sizeForItemAtIndexPath:
![Page 56: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/56.jpg)
Expandable cell
•
• estimatedItemSize+invalidLayout+UIViewAnimation
• sizeForCellAtIndexPath+performBatchUpdate:
![Page 57: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/57.jpg)
• TableView
• estimatedRowHeight
• CollectionView
• cell estimatedItemSize
• sizeForItemAtIndexPath
• Custom flowLayout
• AppDevKit might help for nib!
![Page 58: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/58.jpg)
Xcode 8 & iOS 10
![Page 59: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/59.jpg)
self-sizing in iOS 10
• WWDC 216 What's New in UICollectionView in iOS 10
•
flowLayout.estimatedItemSize = UICollectionViewFlowLayoutAutomaticSize
![Page 60: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/60.jpg)
xib in Xcode 8
![Page 61: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/61.jpg)
xib in Xcode 8
• xib constraint frame
• init frame
• Update:Xcode 8.1
![Page 62: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/62.jpg)
Frame size1000!
![Page 63: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/63.jpg)
xib in Xcode 8
NSLayoutConstraint(item: star, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 0.0, constant: self.frame.height).isActive = true;
” ”
![Page 64: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/64.jpg)
1000x1000 star!
![Page 65: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/65.jpg)
Solution
• or 0NSLayoutConstraint(item: star, attribute: .height, relatedBy: .equal, toItem: self, attribute: .height, multiplier: 1.0, constant: 0.0).isActive = true;
![Page 66: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/66.jpg)
xibXcode 7
Xcode 8
![Page 67: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/67.jpg)
constraint...
![Page 68: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/68.jpg)
• auto layout constraint
• contentView
layoutIfNeeded
• preferredMaxLayoutWidth
![Page 69: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/69.jpg)
![Page 70: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/70.jpg)
• xib
• size constraint
• constraint self.frame.size
![Page 71: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/71.jpg)
constraint ...
![Page 72: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/72.jpg)
Self-sizing checklist
• estimatedItemSize
• cellpreferredLayoutAttributesFittingAttributes
• self-sizing constraint
![Page 73: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/73.jpg)
Self-sizing checklist• sizeForItemAtIndexPath:
• cache cell
• constraint frame
• self-sizing constraint
• ADKNibSizeCalculator & ADKCellDynamicSizeCalculator can help!
![Page 74: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/74.jpg)
…
• self-sizing constraint
• ( )
• preferredMaxLayoutWidth
![Page 75: iOS 上 self-sizing cell 的過去、現在、與未來](https://reader036.fdocuments.net/reader036/viewer/2022082202/58ef63621a28ab2d6a8b45e5/html5/thumbnails/75.jpg)
Thank you!