FDTemplateLayoutCell alternatives and similar libraries
Based on the "Layout" category.
Alternatively, view FDTemplateLayoutCell alternatives based on common mentions on social networks and blogs.
-
Masonry
Harness the power of AutoLayout NSLayoutConstraints with a simplified, chainable and expressive syntax. Supports iOS and OSX Auto Layout -
PureLayout
The ultimate API for iOS & OS X Auto Layout — impressively simple, immensely powerful. Objective-C and Swift compatible. -
Cartography
A declarative Auto Layout DSL for Swift :iphone::triangular_ruler: -
MyLinearLayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView RTL -
DeviceKit
DeviceKit is a value-type replacement of UIDevice. -
LayoutKit
LayoutKit is a fast view layout library for iOS, macOS, and tvOS. -
PinLayout
Fast Swift Views layouting without auto layout. No magic, pure code, full control and blazing fast. Concise syntax, intuitive, readable & chainable. [iOS/macOS/tvOS/CALayer] -
FlexLayout
FlexLayout adds a nice Swift interface to the highly optimized facebook/yoga flexbox implementation. Concise, intuitive & chainable syntax. -
Device
Light weight tool for detecting the current device and screen size written in swift. -
FLKAutoLayout
UIView category which makes it easy to create layout constraints in code -
set-simulator-location
CLI for setting location in the iOS simulator -
Compose
Compose is a library that helps you compose complex and dynamic views. -
Anchorage
A collection of operators and utilities that simplify iOS layout code. -
Relayout
Swift microframework for declaring Auto Layout constraints functionally -
EasyAnchor
⚓️ Declarative, extensible, powerful Auto Layout -
UIDeviceComplete
UIDevice extensions that fill in the missing pieces. -
Luminous
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform. -
FlexboxLayout
Port of Facebook's css-layout to Swift -
MisterFusion
MisterFusion is Swift DSL for AutoLayout. It is the extremely clear, but concise syntax, in addition, can be used in both Swift and Objective-C. Support Safe Area and Size Class. -
Cupcake
An easy way to create and layout UI components for iOS (Swift version). -
Anchors
Declarative, extensible, powerful Auto Layout for iOS 8+ and macOS 10.10+ -
QuickLayout
Written in pure Swift, QuickLayout offers a simple and easy way to manage Auto Layout in code. -
ManualLayout
✂ Easy to use and flexible library for manually laying out views and layers for iOS and tvOS. Supports AsyncDisplayKit. -
TapticEngine
TapticEngine generates haptic feedback vibrations on iOS device. -
WatchShaker
Simple motion detector for ⌚️ (watchOS) shake gesture. -
MondrianLayout
🏗 A way to build AutoLayout rapidly than using InterfaceBuilder(XIB, Storyboard) in iOS. -
BBLocationManager
A Location Manager for easily implementing location services & geofencing in iOS. Ready for iOS 11. -
Framezilla
Elegant library that wraps working with frames with a nice chaining syntax. -
Anchorman
An autolayout library for the damn fine citizens of San Diego. -
Auto Layout Magic
Build 1 scene, let AutoLayoutMagic generate the constraints for you! -
SuperLayout
SuperLayout is a Swift library that makes using Auto Layout a breeze.
Appwrite - The open-source backend cloud platform
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of FDTemplateLayoutCell or a related project?
README
UITableView-FDTemplateLayoutCell
Overview
Template auto layout cell for automatically UITableViewCell height calculating.
Basic usage
If you have a self-satisfied cell, then all you have to do is:
#import "UITableView+FDTemplateLayoutCell.h"
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return [tableView fd_heightForCellWithIdentifier:@"reuse identifer" configuration:^(id cell) {
// Configure this cell with data, same as what you've done in "-tableView:cellForRowAtIndexPath:"
// Like:
// cell.entity = self.feedEntities[indexPath.row];
}];
}
Height Caching API
Since iOS8, -tableView:heightForRowAtIndexPath:
will be called more times than we expect, we can feel these extra calculations when scrolling. So we provide another API with cache by index path:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return [tableView fd_heightForCellWithIdentifier:@"identifer" cacheByIndexPath:indexPath configuration:^(id cell) {
// configurations
}];
}
Or, if your entity has an unique identifier, use cache by key API:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
Entity *entity = self.entities[indexPath.row];
return [tableView fd_heightForCellWithIdentifier:@"identifer" cacheByKey:entity.uid configuration:^(id cell) {
// configurations
}];
}
Frame layout mode
FDTemplateLayoutCell
offers 2 modes for asking cell's height.
- Auto layout mode using "-systemLayoutSizeFittingSize:"
- Frame layout mode using "-sizeThatFits:"
Generally, no need to care about modes, it will automatically choose a proper mode by whether you have set auto layout constrants on cell's content view. If you want to enforce frame layout mode, enable this property in your cell's configuration block:
cell.fd_enforceFrameLayout = YES;
And if you're using frame layout mode, you must override -sizeThatFits:
in your customized cell and return content view's height (separator excluded)
- (CGSize)sizeThatFits:(CGSize)size {
return CGSizeMake(size.width, A+B+C+D+E+....);
}
Debug log
Debug log helps to debug or inspect what is this "FDTemplateLayoutCell" extention doing, turning on to print logs when "calculating", "precaching" or "hitting cache".Default to "NO", log by "NSLog".
self.tableView.fd_debugLogEnabled = YES;
It will print like this:
** FDTemplateLayoutCell ** layout cell created - FDFeedCell
** FDTemplateLayoutCell ** calculate - [0:0] 233.5
** FDTemplateLayoutCell ** calculate - [0:1] 155.5
** FDTemplateLayoutCell ** calculate - [0:2] 258
** FDTemplateLayoutCell ** calculate - [0:3] 284
** FDTemplateLayoutCell ** precached - [0:3] 284
** FDTemplateLayoutCell ** calculate - [0:4] 278.5
** FDTemplateLayoutCell ** precached - [0:4] 278.5
** FDTemplateLayoutCell ** hit cache - [0:3] 284
** FDTemplateLayoutCell ** hit cache - [0:4] 278.5
** FDTemplateLayoutCell ** hit cache - [0:5] 156
** FDTemplateLayoutCell ** hit cache - [0:6] 165
About self-satisfied cell
a fully self-satisfied cell is constrainted by auto layout and each edge("top", "left", "bottom", "right") has at least one layout constraint against it. It's the same concept introduced as "self-sizing cell" in iOS8 using auto layout.
A bad one :( - missing right and bottom
A good one :)
Notes
A template layout cell is created by -dequeueReusableCellWithIdentifier:
method, it means that you MUST have registered this cell reuse identifier by one of:
- A prototype cell of UITableView in storyboard.
- Use
-registerNib:forCellReuseIdentifier:
- Use
-registerClass:forCellReuseIdentifier:
如果你在天朝
可以看这篇中文博客: http://blog.sunnyxx.com/2015/05/17/cell-height-calculation/
Installation
Latest version: 1.6
pod search UITableView+FDTemplateLayoutCell
If you cannot search out the latest version, try:
pod setup
Release Notes
We recommend to use the latest release in cocoapods.
1.6 fix bug in iOS 10
1.4
Refactor, add "cacheByKey" mode, bug fixed1.3
Frame layout mode, handle cell's accessory view/type1.2
Precache and auto cache invalidation1.1
Height cache1.0
Basic automatically height calculation
License
MIT
*Note that all licence references and agreements mentioned in the FDTemplateLayoutCell README section above
are relevant to that project's source code only.