Skip to main content

Poll Option Widget

Overview

The LMChatCreatePollOptionWidget is a custom table view cell that represents a single poll option in the poll creation process. It provides a text field for entering the option text and an optional cross button for removing the option.

UI Components

  • optionTextField: An LMTextField for entering the poll option text.
  • crossButton: An LMButton for removing the poll option.
  • sepratorView: An LMView that serves as a separator below the option.

Methods

  • onTapCrossButton(): Handles taps on the cross button to remove the option.
  • valueChanged(_:): Handles changes to the option text field.
  • configure(with:isShowCrossIcon:onCrossButtonCallback:onTextValueChanged:): Used to configure the widget
  • retriveText(): Used to get the current text value of the option text field.

Customization

CustomPollOptionWidget
class CustomPollOptionWidget: LMChatCreatePollOptionWidget {
override func setupAppearance() {
super.setupAppearance()
// Add custom appearance setup here
}

override func onTapCrossButton() {
super.onTapCrossButton()
// Add custom handling here
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.createPollOptionCell = CustomPollOptionWidget.self
// ...
return true
}