CustomSegmentedControl
Simple custom segmented control for UIKit (iOS)
Install / Use
/learn @dancarvajc/CustomSegmentedControlREADME
CustomSegmentedControl
An simple example of a custom segmented control for UIKit.
<img src="assets/RocketSim_Screenshot_iPhone_14_Pro_2023-02-10_14.35.05.png" alt="RocketSim_Screenshot_iPhone_14_Pro_2023-02-10_14.35.05" width="200" /><img src="assets/RocketSim_Screenshot_iPhone_14_Pro_2023-02-10_14.36.08.png" alt="RocketSim_Screenshot_iPhone_14_Pro_2023-02-10_14.36.08" width="500" />
Use
Declares the titles for each segment in an array.
private let buttonTitles: [String] = ["Button 1", "Button 2", "Button 3"]
Then create an instance of the custom segmented control passing it the array as argument:
private lazy var segmentedControl: CustomSegmetedControl = CustomSegmetedControl(buttonTitles: buttonTitles)
Finally, conforms to the delegate protocol to know which button was pressed.
extension ViewController: CustomSegmetedControlDelegate {
func buttonPressed(buttonTitlesIndex: Int, title: String?) {
// some action
}
}
Video
https://user-images.githubusercontent.com/71818002/218160590-67edcb86-1646-41f7-92a6-9f231f8f766f.mp4
Related Skills
node-connect
346.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
346.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
346.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
