Skip to main content

Create Poll Question View

Overview

The LMChatCreatePollQuestionView is a custom UIView subclass that manages the creation of poll questions and options in a chat interface.

Functionality

Protocols

This view implements the UITableViewDataSource and UITableViewDelegate protocols.

It also defines a custom protocol:

  • LMChatCreatePollQuestionViewProtocol: Handles user interactions with poll options.

UI Components

  • containerView: An LMView that holds all other UI elements.
  • answerLabel: An LMLabel displaying "Answer options".
  • optionStack: An LMTableView showing the list of poll options.
  • addOptionView: An LMView for adding new options.
  • addOptionImage: An LMImageView showing a plus icon.
  • addOptionText: An LMLabel displaying "Add new option".

Methods

  • configure(with:delegate:): Initializes the view with data and a delegate.
  • updateOptions(with:): Updates the poll options.
  • retrieveTextFromOptions(): Retrieves the text from all visible option cells.

Customization

CustomCreatePollQuestionView
class CustomCreatePollQuestionView: LMChatCreatePollQuestionView {
override func setupAppearance() {
super.setupAppearance()
// Add custom styling here
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.createPollQuestionView = CustomCreatePollQuestionView.self
// ...
return true
}