Closed utkbansal closed 8 years ago
Check SimpleDataGridViewController
and dataGridView:cellForItemAtIndexPath
method:
func dataGridView(dataGridView: DataGridView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
let cell = dataGridView.dequeueReusableCellWithReuseIdentifier(DataGridView.ReuseIdentifiers.defaultCell, forIndexPath: indexPath) as! DataGridViewContentCell
cell.textLabel.text = "Some text"
cell.textLabel.font = UIFont.systemFontOfSize(20)
if indexPath.dataGridColumn == 0 {
cell.textLabel.textColor = UIColor.redColor()
} else {
cell.textLabel.textColor = UIColor.darkTextColor()
}
// ... further customization
return cell
}
You can also use UIAppearance
to change all cells appearance:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let labelAppearance = UILabel.glyuck_appearanceWhenContainedIn(DataGridViewContentCell.self)
labelAppearance.appearanceFont = UIFont.systemFontOfSize(17, weight: UIFontWeightLight)
labelAppearance.appearanceTextColor = UIColor.darkGrayColor()
// ...
return true
}
Please, note: you need to use appearanceFont
and appearanceTextColor
properties for customizing UILabel
via UIAppearance
(see UILabel (AppearanceSelectors)
extension)
How can I change the font size and the color of the text in a cell? I am using the example in the README.