Chat Poll View
Overview
The LMChatPollView
is responsible for displaying and managing interactive polls. It provides functionality for users to view poll questions, vote on options, submit votes, and interact with poll-related features.
Functionality
Protocols Implemented
- LMChatDisplayPollWidgetProtocol: Manages user interactions with poll options and vote counts.
UI Components
bottomStack
: A verticalLMStackView
for arranging bottom elements.topStack
: A verticalLMStackView
for arranging top elements.submitButton
: AnLMButton
for submitting votes.bottomMetaStack
: A horizontalLMStackView
for bottom metadata.topMetaStack
: A horizontalLMStackView
for top metadata.answerTitleLabel
: AnLMLabel
for displaying answer information.editVoteButton
: AnLMButton
for editing votes.addOptionButton
: AnLMButton
for adding new poll options.questionAndSelectcount
: A verticalLMStackView
for question and selection count.
Methods
configure(with:delegate:)
: Configures the view with poll data and sets the delegate.
Customization
CustomChatPollView.swift
class CustomChatPollView: LMChatPollView {
override func setupAppearance() {
super.setupAppearance()
submitButton.backgroundColor = .blue
answerTitleLabel.textColor = .darkGray
}
override func setupLayouts() {
super.setupLayouts()
// Add custom layout constraints here
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.pollDisplayView = CustomChatPollView.self
// ...
return true
}