Comments (1)
We can change the cell of a particular row by setting up its cellProvider
property.
Cell Type can not be changed since it's defined in the row type using generics.
Taking as an example the WeeklyDayRow
, as we can see below it only works with WeekDayCell
as its type defines.
public final class WeekDayRow: Row<Set<WeekDay>, WeekDayCell>, RowType
This is the CellProvider generic type:
public struct CellProvider<Cell: BaseCell where Cell: CellType> {
/// Nibname of the cell that will be created.
public private (set) var nibName: String?
/// Bundle from which to get the nib file.
public private (set) var bundle: NSBundle!
public init(){}
public init(nibName: String, bundle: NSBundle? = nil){
self.nibName = nibName
self.bundle = bundle ?? NSBundle(forClass: Cell.self)
}
/**
Creates the cell with the specified style.
- parameter cellStyle: The style with which the cell will be created.
- returns: the cell
*/
func createCell(cellStyle: UITableViewCellStyle) -> Cell {
if let nibName = self.nibName {
return bundle.loadNibNamed(nibName, owner: nil, options: nil).first as! Cell
}
return Cell.init(style: cellStyle, reuseIdentifier: nil)
}
}
Since PushRow<T>
cell must be a PushSelectorCell<T>
and we can not use generic types from interface builder, the only option we have is go for custom rows.
In oder to use a xib file to load the view of your custom row cell, you should set up your custom row cellProvider
property.
Code snippet bellow shows how WeekDayRow
does it:
public final class WeekDayRow: Row<Set<WeekDay>, WeekDayCell>, RowType {
required public init(tag: String?) {
super.init(tag: tag)
displayValueFor = nil
cellProvider = CellProvider<WeekDayCell>(nibName: "WeekDaysCell")
}
}
Regards
from eureka.
Related Issues (20)
- How to set the position and size of the form HOT 2
- What is the difference between cellUpdate and cellSetup? HOT 1
- TimePickerRow is undeletable in MultivaluedSection HOT 2
- The image of the minus button does not disappear in MultivaluedSection for MultivaluedOptions = [.Insert] HOT 2
- App Store Connect Operation Error: The app references non-public selectors HOT 11
- dyld: Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib HOT 2
- Extend cell with another cell
- Section custom header with xib file+class HOT 10
- SegmentedRow crash due to selectedSegmentIndex == -1 HOT 9
- Reordering sections and rows will return the same initial order and not the updated ones HOT 2
- custom Table Inline Row
- SwitchRow Not responding to second time from user interaction HOT 1
- M1 chip Computer + React Native 0.68 + Xcode 14.2 = Compiling Error HOT 1
- Enable BUILD_LIBRARY_FOR_DISTRIBUTION
- Any rule to validate special characters/ numbers in text field in a cell HOT 1
- Food
- How to turn off the capitalization of Section header tiitle? HOT 1
- Bug in iOS 17 Crash app HOT 1
- How to add multivalued .insert options without a multivalued section?
- Index Validation and Safer Collection Handling in Eureka
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eureka.