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.
File Location:
LMChatCreatePollMetaView.swift
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: An LMView that serves as the main container for the view.metaOptionStackView: An LMStackView that holds the individual meta option widgets.optionContainerView: An LMView that contains the "who can vote" and "max options" settings.titleLabel: An LMLabel that displays the title for the "who can vote" setting.optionTypeButton: AnLMChatCreatePollUserOptionWidgetthat displays the current "who can vote" setting.maxOptionButton: AnLMChatCreatePollUserOptionWidgetthat displays the current maximum number of options a user can select.equalSymbol: An LMImageView 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
}