在iOS中轻松使用FAQ视图 - FAQView

2016-12-01      331      Swift
项目简介

FAQView

在iOS中轻松使用FAQ视图,使用Swift编写。

  • 这个视图是一个UIView的子类。

CocoaPods步骤

如果你使用Cocoapods,可以在你的Podfile中添加这个文本并运行 pod install.

use_frameworks!
target 'Your target name'
pod 'FAQView'

或者添加源文件

直接将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, items: items)
view.addSubview(faqView)

自定义

// Change title
faqView.titleLabelText = "Top Queries"

// 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

Requirements

  • Swift 3 / Xcode 8
  • iOS 9.0