Skip to main content

Create Poll Header View

Overview

The LMChatCreatePollHeader displays the header section for creating a poll in a chat interface. It shows the user's profile, username, and a text field for entering the poll question.

UI Components

  • containerView: An LMView that holds all other UI elements.
  • userProfileImage: An LMImageView displaying the user's profile picture.
  • userNameLabel: An LMLabel showing the username.
  • pollQuestionTitle: An LMLabel with the text "Poll question".
  • pollQuestionTextField: An LMTextView for entering the poll question.

Methods

  • setupViews(): Sets up the view hierarchy.
  • setupLayouts(): Configures the layout constraints for the UI components.
  • setupAppearance(): Sets the visual appearance of the view.
  • configure(with:): Initializes the view with user data and poll question.
  • retrivePollQestion(): Retrieves the entered poll question.

Customization

To customize the LMChatCreatePollHeader, subclass it and override the necessary methods:

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