Poll Meta View
Overview
The LMChatCreatePollMetaView
is a custom view that displays additional settings and options for a poll. It allows the user to configure options such as who can vote and the maximum number of options a user can select.
Functionality
Protocols
LMChatCreatePollMetaViewProtocol
onTapUserMetaOptions()
: Called when the user taps on the option to select who can vote.onValueChanged(for:)
: Called when the value of a meta option is changed.
UI Components
containerView
: AnLMView
that serves as the main container for the view.metaOptionStackView
: AnLMStackView
that holds the individual meta option widgets.optionContainerView
: AnLMView
that contains the "who can vote" and "max options" settings.titleLabel
: AnLMLabel
that displays the title for the "who can vote" setting.optionTypeButton
: AnLMChatCreatePollUserOptionWidget
that displays the current "who can vote" setting.maxOptionButton
: AnLMChatCreatePollUserOptionWidget
that displays the current maximum number of options a user can select.equalSymbol
: AnLMImageView
that displays an equal symbol between the "who can vote" and "max options" settings.
Methods
onTapUserMetaOptions()
: Handles taps on the "who can vote" or "max options" settings.configure(with:delegate:)
: Configures the view.updateUserMetaOption(option:count:)
: Updates the displayed "who can vote" and "max options" settings.optionCountFormatted(_:)
: Formats the "max options" value as a string.
Customization
CustomPollMetaView
class CustomPollMetaView: LMChatCreatePollMetaView {
override func setupAppearance() {
super.setupAppearance()
// Add custom appearance setup here
}
override func onTapUserMetaOptions() {
super.onTapUserMetaOptions()
// Add custom handling here
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.createPollMetaView = CustomPollMetaView.self
// ...
return true
}