forked from veader/V8HorizontalPickerView
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathV8HorizontalPickerView.h
More file actions
94 lines (72 loc) · 2.83 KB
/
V8HorizontalPickerView.h
File metadata and controls
94 lines (72 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
//
// V8HorizontalPickerView.h
//
// Created by Shawn Veader on 9/17/10.
// Copyright 2010 V8 Labs, LLC. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "V8HorizontalPickerViewProtocol.h"
// position of indicator view, if shown
typedef enum {
V8HorizontalPickerIndicatorBottom = 0,
V8HorizontalPickerIndicatorTop
} V8HorizontalPickerIndicatorPosition;
@interface V8HorizontalPickerView : UIView <UIScrollViewDelegate> {
UIScrollView *_scrollView;
// collection of widths of each element.
NSMutableArray *elementWidths;
// what font to use for the element labels?
UIFont *elementFont;
// color of labels used in picker
UIColor *textColor;
UIColor *selectedTextColor; // color of current selected element
NSInteger numberOfElements;
NSInteger elementPadding;
NSInteger currentSelectedIndex;
V8HorizontalPickerIndicatorPosition indicatorPosition;
// the point, defaults to center of view, where the selected element sits
CGPoint selectionPoint;
UIView *selectionIndicatorView;
// views to display on edges of picker (eg: gradients, etc)
UIView *leftEdgeView;
UIView *rightEdgeView;
// views for left and right of scrolling area
UIView *leftScrollEdgeView;
UIView *rightScrollEdgeView;
// padding for left/right scroll edge views
CGFloat scrollEdgeViewPadding;
// state keepers
BOOL dataHasBeenLoaded;
BOOL scrollSizeHasBeenSet;
// keep track of which elements are visible for tiling
int firstVisibleElement;
int lastVisibleElement;
}
@property (nonatomic, weak) id <V8HorizontalPickerViewDataSource> dataSource;
@property (nonatomic, weak) id <V8HorizontalPickerViewDelegate> delegate;
@property (nonatomic, readonly) NSInteger numberOfElements;
@property (nonatomic, readonly) NSInteger currentSelectedIndex;
@property (nonatomic, strong) UIFont *elementFont;
@property (nonatomic, strong) UIColor *textColor;
@property (nonatomic, strong) UIColor *selectedTextColor;
@property (nonatomic, assign) CGPoint selectionPoint;
@property (nonatomic, strong) UIView *selectionIndicatorView;
@property (nonatomic, assign) V8HorizontalPickerIndicatorPosition indicatorPosition;
@property (nonatomic, strong) UIView *leftEdgeView;
@property (nonatomic, strong) UIView *rightEdgeView;
@property (nonatomic, strong) UIView *leftScrollEdgeView;
@property (nonatomic, strong) UIView *rightScrollEdgeView;
@property (nonatomic, assign) CGFloat scrollEdgeViewPadding;
- (void)reloadData;
- (void)scrollToElement:(NSInteger)index animated:(BOOL)animate;
@end
// sub-class of UILabel that knows how to change it's state
@interface V8HorizontalPickerLabel : UILabel <V8HorizontalPickerElementState> {
BOOL selectedElement;
UIColor *selectedStateColor;
UIColor *normalStateColor;
}
@property (nonatomic, assign) BOOL selectedElement;
@property (nonatomic, retain) UIColor *selectedStateColor;
@property (nonatomic, retain) UIColor *normalStateColor;
@end