FAQView 0.7.0

FAQView 0.7.0

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布最后发布2022年5月
SPM支持SPM

Mukesh Thawani维护。



FAQView 0.7.0

FAQView

一个使用Swift编写的易于使用的iOS FAQ视图。

  • 此视图是UIView的子类。


FAQView FAQView

使用CocoaPods设置

如果您正在使用CocoaPods,请将此文本添加到Podfile中并运行pod install

use_frameworks!
target 'Your target name'
pod 'FAQView', '~> 0.5.0'

或添加源

简单地将FAQView.swift文件添加到您的项目中。

使用方法

从代码创建视图

let items = [FAQItem(question: "What is reddit?", answer: "reddit is a source for what's new and popular on the web."),
            FAQItem(question: "How is a submission's score determined?", answer: "A submission's score is simply the number of upvotes minus the number of downvotes.")]

let faqView = FAQView(frame: view.frame, title: "Top Queries", items: items)
view.addSubview(faqView)

带有属性的文字答案

您可以使用带有属性的文字而不是纯文本。将项目的 attributedAnswer 属性设置为 NSAttributedString。

定制

// Question text color  
faqView.questionTextColor = UIColor.blue

// Answer text color
faqView.answerTextColor = UIColor.blue

// Question text font
faqView.questionTextFont = UIFont(name: "HelveticaNeue-Light", size: 15)

// View background color
faqView.viewBackgroundColor = UIColor.white

// Set up data detectors for automatic detection of links, phone numbers, etc., contained within the answer text.
faqView.dataDetectorTypes = [.phoneNumber, .calendarEvent, .link]

// Set color for links and detected data
faqView.tintColor = UIColor.red

要求

  • Swift 4.0
  • Xcode 9.0+
  • FAQView 0.4.x 与 Swift 3 兼容
  • iOS 9.0+

作者

Mukesh Thawani

贡献

欢迎提出功能请求、错误报告和拉取请求。

许可

版权所有(c)2016-至今 Mukesh Thawani。在MIT许可证下发布。