FUIContactCell
@IBDesignable
open class FUIContactCell : NibDesignableFUIBaseTableViewCell, FUIActivityControlDelegate
FUIContactCell
is variant of UITableViewCell
defined in SAPFiori. It contains a UIImageView
, several UILabel
s and a FUIActivityControl
component.
It supports most 3 activity items by default. You can change it by setting maxVisibleItems
on activityControl
property.
Code usage:
//Create a FUIContactCell in a TableView
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: FUIContactCell.reuseIdentifier) as! FUIContactCell
let activities: [ActivityItem] = [ActivityItem.phone, ActivityItem.message]
let contact = DataSource.contact[indexPath.row]
cell.detailImage = contact.image
cell.headlineText = contact.name
cell.subheadlineText = contact.title
cell.descriptionText = contact.address
cell.activityControl.addActivities(activities)
// Optionally, adjust activity item size (defaults to `CGSize(width: 25.0, height: 25.0)`)
self.activityControl.itemSize = CGSize(width: 25, height: 25)
// Optionally, adjust limit on visible items in activity control (defaults to `3`)
self.activityControl.maxVisibleItems = 3
// Optionally, adjust activity control spacing (defaults to `29.0`)
self.activityControl.stackView.spacing = 29.0
// Implement onActivitySelectedHandler.
cell.onActivitySelectedHandler = { activityItem in
switch activityItem {
case ActivityItem.phone:
let _ = contact.call()
case ActivityItem.message:
let _ = contact.sendMessage()
case ActivityItem.videoCall:
let _ = contact.video()
default:
break
}
}
}
## Theming Supported style classes
fdlFUIContactCell
fdlFUIContactCell_headlineLabel
fdlFUIContactCell_subheadlineLabel
fdlFUIContactCell_descriptionLabel
-
Reuse identifier
Declaration
Swift
open class var reuseIdentifier: String { get }
-
The FUIImageView holds a detail image.
Declaration
Swift
@IBOutlet public private(set) var detailImageView: FUIImageView!
-
The UILabel holds headline text.
Declaration
Swift
@IBOutlet public private(set) weak var headlineLabel: FUILabel!
-
The UILabel holds subheadline text.
Declaration
Swift
@IBOutlet public private(set) weak var subheadlineLabel: FUILabel!
-
The UILabel holds description text.
Declaration
Swift
@IBOutlet public private(set) var descriptionLabel: FUILabel!
-
The FUIActivityControl object used in ContactCell.
Declaration
Swift
@IBOutlet public private(set) var activityControl: FUIActivityControl!
-
Optional handler closure for
ActivityItem
selection.cell.onActivitySelectedHandler = { [weak contact] activityItem in switch activityItem { case ActivityItem.phone: let _ = contact?.call() case ActivityItem.message: let _ = contact?.sendMessage() case ActivityItem.videoCall: let _ = contact?.video() default: break } }
Declaration
Swift
open var onActivitySelectedHandler: ((FUIActivityItem) -> Void)?
-
Default main stack right edge is set at midpoint of cell’s readable width, minus 8px. Set to fraction between 0.01 and 0.99, to move the right edge of the
mainStack
, relative to the cell readable width.Important
the percentage of readable width includes area often containing other subviews. So, a valid value is typically between 30% and 70%.Only used when
horizontalSizeClass
of the object cell is.regular
.Declaration
Swift
public var splitPercent: CGFloat { get set }
-
Declaration
Swift
open func activityControl(_ activityControl: FUIActivityControl, didSelectActivity activityItem: FUIActivityItem)
-
Property to preserve
detailImageView
spacing. When it’s set to true, spacing is preserved fordetailImageView
even when there’s no image added to the image viewDeclaration
Swift
public var preserveDetailImageSpacing: Bool { get set }
-
Text of headline label.
Declaration
Swift
@IBInspectable public var headlineText: String? { get set }
-
Text of subheadline label.
Declaration
Swift
@IBInspectable public var subheadlineText: String? { get set }
-
Text of
descriptionLabel
.Declaration
Swift
@IBInspectable public var descriptionText: String? { get set }
-
Image of ContactCell.
Declaration
Swift
@IBInspectable public var detailImage: UIImage? { get set }
-
Text of
tags
for IB display purpose onlyDeclaration
Swift
@IBInspectable public var ibDisplayActivityControl: String? { get set }