Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <UIKit/UIKit.h>
- typedef void (^IndexChangeBlock)(NSInteger index);
- typedef enum {
- redSegmentedControlTypeText,
- redSegmentedControlTypeImages
- } redSegmentedControlType;
- typedef enum {
- redSegmentedControlSelectionStyleTextWidthStrip, // Indicator width will only be as big as the text width
- redSegmentedControlSelectionStyleFullWidthStrip, // Indicator width will fill the whole segment
- redSegmentedControlSelectionStyleBox
- } redSegmentedControlSelectionStyle;
- typedef enum {
- redSegmentedControlSelectionLocationUp,
- redSegmentedControlSelectionLocationDown
- } redSegmentedControlSelectionLocation;
- enum {
- redSegmentedControlNoSegment = -1 // segment index for no selected segment
- };
- @interface redSegmentedControl : UIControl
- @property (nonatomic, strong) NSArray *sectionTitles;
- @property (nonatomic, strong) NSArray *sectionImages;
- @property (nonatomic, strong) NSArray *sectionSelectedImages;
- @property (nonatomic, copy) IndexChangeBlock indexChangeBlock; // you can also use addTarget:action:forControlEvents:
- @property (nonatomic, strong) UIFont *font; // default is [UIFont fontWithName:@"STHeitiSC-Light" size:18.0f]
- @property (nonatomic, strong) UIColor *textColor; // default is [UIColor blackColor]
- @property (nonatomic, strong) UIColor *selectedTextColor; // default is [UIColor blackColor]
- @property (nonatomic, strong) UIColor *backgroundColor; // default is [UIColor whiteColor]
- @property (nonatomic, strong) UIColor *selectionIndicatorColor; // default is R:52, G:181, B:229
- @property (nonatomic, assign) redSegmentedControlSelectionStyle selectionStyle; // Default is redSegmentedControlSelectionStyleTextWidthStrip
- @property (nonatomic, assign) redSegmentedControlSelectionLocation selectionLocation; // Default is redSegmentedControlSelectionLocationUp
- @property (nonatomic, assign) redSegmentedControlType type;
- @property (nonatomic, assign) NSInteger selectedSegmentIndex;
- @property (nonatomic, readwrite) CGFloat height; // default is 32.0
- @property (nonatomic, readwrite) CGFloat selectionIndicatorHeight; // default is 5.0
- @property (nonatomic, readwrite) UIEdgeInsets segmentEdgeInset; // default is UIEdgeInsetsMake(0, 5, 0, 5)
- - (id)initWithSectionTitles:(NSArray *)sectiontitles;
- - (id)initWithSectionImages:(NSArray *)sectionImages sectionSelectedImages:(NSArray *)sectionSelectedImages;
- - (void)setSelectedSegmentIndex:(NSUInteger)index animated:(BOOL)animated;
- - (void)setIndexChangeBlock:(IndexChangeBlock)indexChangeBlock;
- @end
Advertisement
Add Comment
Please, Sign In to add comment