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
: AnLMTextField
for entering the poll option text.crossButton
: AnLMButton
for removing the poll option.sepratorView
: AnLMView
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 widgetretriveText()
: 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
}