Skip to content

Contact Cell

FUIContactCell

@IBDesignable open class FUIContactCell: NibDesignableFUIBaseTableViewCell, FUIActivityControlDelegate, FUIContentCopyable

FUIContactCell is a variant of UITableViewCell defined in SAPFiori. It contains a UIImageView, several UILabels, and a FUIActivityControl component.

It supports three activity items by default. You can change this by setting maxVisibleItems on the activityControl property.

Contact Cell

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
 // To enable a default gradient layer behind the placeholder text.
      cell.detailImageView.isGradientLayerEnabled = true
 // Set placeholder text.
     cell.detailImageView.placeholder.text = "This is a placeholder"
     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

Last update: December 8, 2020