Skip to content

camroth/CRFAQTableViewController

Repository files navigation

CRFAQTableViewController

CRFAQTableViewController allows you to quickly and easily display a clickable interface to navigate question and answer style content. All lines automatically account for the required height to display a question or answer, and an indexed table of contents appears at the top for quick navigation.

CRFAQTableViewController demo

Usage

CRFAQTableViewController *faqViewController = [[CRFAQTableViewController alloc] init];
[faqViewController addQuestion:@"How Many Questions Can I Add?" withAnswer:@"As many as you want!"];

Optionally, an initializer exists to create an FAQ with existing data:

- (instancetype)initWithQuestions:(NSArray *)questions;

Where questions take the form of an array of 2-item arrays:

@[	@[ @"Question", @"Answer" ]	]

Once you have your CRFAQTableViewController created, you can always add more questions:

- (void)addQuestion:(NSString *)question withAnswer:(NSString *)answer;

While sane defaults have been chosen, you might want your FAQ to look and feel differently. For your convenience and customization, you can use these:

- (void)setHighlightedQuestionDelay:(float)highlightedQuestionDelay;
- (void)setHighlightedQuestionDuration:(float)highlightedQuestionDuration;
- (void)setHighlightedQuestionColor:(UIColor *)highlightedQuestionColor;
- (void)setIndexTitle:(NSString *)indexTitle;
- (void)setFontForQuestions:(UIFont *)fontForQuestions;
- (void)setFontForAnswers:(UIFont *)fontForAnswers;
- (void)setSectionHeadersToUppercase:(BOOL)isUppercase;

Installation

CRFAQTableViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "CRFAQTableViewController"

If you're not using CocoaPods, you'll want to place both the h/m/xib somewhere in your project.

License

CRFAQTableViewController is available under the MIT license. See the LICENSE file for more info.

Screenshots

Table of contents Item selected example

About

CRFAQTableViewController allows you to quickly and easily display a clickable interface to navigate question and answer style content.

Resources

License

Stars

Watchers

Forks

Packages

No packages published