CocoaPods trunk is moving to be read-only. Read more on the blog, there are 13 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Feb 2016 |
Maintained by belakva.
QAView represents 2 UIScrollViews:_questionsScroller & _answersScroller populated with 2 arrays: _questions & _answers respectively. When a question is tapped, it becomes active and ready to be connected to answers. Use this pod whenever you have to visualize dependencies in between elements of 2 arrays.
Just drag and drop the QAView/QAView folder into your project.
Set up is easy as
_qaView = [[QAView alloc] initWithFrame:self.view.frame
questions:@[@"Frank",
@"Jason"]
answers:@[@"Anna",
@"Maria",
@"Jessica"]];You can set highlight colors
_qaView.colors = @[[UIColor greenColor], [UIColor purpleColor]];If not set, highlight colors are generated automatically with hue step = (360./[questions count])/360.
You can set inactive color
_qaView.inactiveColor = [UIColor redColor];Default is gray with lightness = 0.89
Set logic scheme
_qaView.canUseOneAnswerToSeveralQuestions = NO; //Defaults to YES
_qaView.canUseSeveralAnswersToOneQuestion = NO; //Defaults to YESYou can set whatever you like as QAView delegate
_qaView.delegate = self;To do this, adopt <QAViewDelegate> protocol.
It has following @optional methods:
- (void)didRecieveTapInAnswerView:(QAItemView *)view;
- (void)didRecieveTapInQuestionView:(QAItemView *)view;
- (void)answersScrollerDidScroll:(QAScrollView *)scrollView;
- (void)questionsScrollerDidScroll:(QAScrollView *)scrollView;
- (QAItemView *)itemViewForAnswerAtIndex:(NSUInteger)index; //cutom cell set up
- (QAItemView *)itemViewForQuestionAtIndex:(NSUInteger)index; //custom cell set up
- (NSUInteger)numberOfAnswers;
- (NSUInteger)numberOfQuestions;Following cell (QAItemView) propeties are designed for custom set up:
@property (strong, nonatomic) UIColor* highlightColor;
@property (strong, nonatomic) UIColor* inactiveColor;;
@property (strong, nonatomic) UILabel* textLabel;
@property (nonatomic) CFTimeInterval connectingAnimationDuration;
@property (nonatomic) CGFloat connectingLineWidth;
@property (nonatomic) BOOL useGradients;
@property (nonatomic) BOOL useCirclesOnLineConnectionPoints;
@property (nonatomic) BOOL useCurvesInConnection;Edit them when initilizing a QAItemView in itemViewForAnswerAtIndex: / itemViewForQuestionAtIndex:.
Important
When initilizing cell with [[QAItemView alloc] init] in itemViewForAnswerAtIndex: / itemViewForQuestionAtIndex:, do not set or retrieve its' frame, as the frame will be set automatically right after this method is called.
FOR MANUAL FRAME SET UP, use following initilizer:
- (id)initWithFrame:(CGRect)frame text:(NSString*)text
index:(NSInteger)index
totalQuestions:(NSInteger)totalQuestions
inactiveColor:(UIColor*)inactiveColor
activeColor:(UIColor*)activeColor
asQuestion:(BOOL)asQuestionFor formula, used for automatic cell frame calculation check Example project.
Call methods of QAView
- (NSIndexSet*)connectedQuestionsIndexesForAnswerAtIndex:(NSUInteger)index;
- (NSIndexSet*)connectedAnswersIndexesForQuestionAtIndex:(NSUInteger)index;Nikita Borisov https://twitter.com/nikita_kerd
QAView is available under the MIT license. See the LICENSE file for more info.