├── .gitignore ├── Classes ├── PFConfiguration.h ├── PFConfiguration.m ├── PFNavigationDropdownMenu.bundle │ ├── arrow_down_icon.png │ ├── arrow_down_icon@2x.png │ ├── arrow_down_icon@3x.png │ ├── checkmark_icon.png │ ├── checkmark_icon@2x.png │ └── checkmark_icon@3x.png ├── PFNavigationDropdownMenu.h ├── PFNavigationDropdownMenu.m ├── PFTableCellContentView.h ├── PFTableCellContentView.m ├── PFTableView.h ├── PFTableView.m ├── PFTableViewCell.h └── PFTableViewCell.m ├── LICENSE ├── PFNavigationDropdownMenu.podspec ├── PFNavigationDropdownMenu.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── PFNavigationDropdownMenu ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ViewController.h ├── ViewController.m └── main.m ├── PFNavigationDropdownMenuTests ├── Info.plist └── PFNavigationDropdownMenuTests.m └── Readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by https://www.gitignore.io 2 | 3 | ### Objective-C ### 4 | # Xcode 5 | # 6 | build/ 7 | *.pbxuser 8 | !default.pbxuser 9 | *.mode1v3 10 | !default.mode1v3 11 | *.mode2v3 12 | !default.mode2v3 13 | *.perspectivev3 14 | !default.perspectivev3 15 | xcuserdata 16 | *.xccheckout 17 | *.moved-aside 18 | DerivedData 19 | *.hmap 20 | *.ipa 21 | *.xcuserstate 22 | 23 | # CocoaPods 24 | # 25 | # We recommend against adding the Pods directory to your .gitignore. However 26 | # you should judge for yourself, the pros and cons are mentioned at: 27 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 28 | # 29 | #Pods/ 30 | 31 | -------------------------------------------------------------------------------- /Classes/PFConfiguration.h: -------------------------------------------------------------------------------- 1 | // 2 | // PFConfiguration.h 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PFConfiguration : NSObject 12 | @property (nonatomic, assign) CGFloat cellHeight; 13 | @property (nonatomic, strong) UIColor *cellBackgroundColor; 14 | @property (nonatomic, strong) UIColor *cellTextLabelColor; 15 | @property (nonatomic, strong) UIFont *cellTextLabelFont; 16 | @property (nonatomic, strong) UIColor *cellSelectionColor; 17 | @property (nonatomic, strong) UIImage *checkMarkImage; 18 | @property (nonatomic, strong) UIImage *arrowImage; 19 | @property (nonatomic, assign) CGFloat arrowPadding; 20 | @property (nonatomic, assign) NSTimeInterval animationDuration; 21 | @property (nonatomic, strong) UIColor *maskBackgroundColor; 22 | @property (nonatomic, assign) CGFloat maskBackgroundOpacity; 23 | @end 24 | -------------------------------------------------------------------------------- /Classes/PFConfiguration.m: -------------------------------------------------------------------------------- 1 | // 2 | // PFConfiguration.m 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "PFConfiguration.h" 10 | 11 | @implementation PFConfiguration 12 | - (instancetype)init 13 | { 14 | self = [super init]; 15 | if (self) { 16 | [self setDefaultValue]; 17 | } 18 | return self; 19 | } 20 | 21 | - (void)setDefaultValue 22 | { 23 | NSBundle *bundle = [NSBundle bundleForClass:[self class]]; 24 | NSURL *url = [bundle URLForResource:@"PFNavigationDropdownMenu" withExtension:@"bundle"]; 25 | NSBundle *imageBundle = [NSBundle bundleWithURL:url]; 26 | NSString *checkMarkImagePath = [imageBundle pathForResource:@"checkmark_icon" ofType:@"png"]; 27 | NSString *arrowImagePath = [imageBundle pathForResource:@"arrow_down_icon" ofType:@"png"]; 28 | 29 | self.cellHeight = 50; 30 | self.cellBackgroundColor = [UIColor whiteColor]; 31 | self.cellTextLabelColor = [UIColor darkGrayColor]; 32 | self.cellTextLabelFont = [UIFont fontWithName:@"HelveticaNeue-Bold" size:17]; 33 | self.cellSelectionColor = [UIColor lightGrayColor]; 34 | self.checkMarkImage = [UIImage imageWithContentsOfFile:checkMarkImagePath]; 35 | self.animationDuration = 0.5; 36 | self.arrowImage = [UIImage imageWithContentsOfFile:arrowImagePath]; 37 | self.arrowPadding = 15; 38 | self.maskBackgroundColor = [UIColor blackColor]; 39 | self.maskBackgroundOpacity = 0.3; 40 | } 41 | @end 42 | -------------------------------------------------------------------------------- /Classes/PFNavigationDropdownMenu.bundle/arrow_down_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectFreeze/PFNavigationDropdownMenu/346337ee253135f2c378c414b5e8243b0896b3ab/Classes/PFNavigationDropdownMenu.bundle/arrow_down_icon.png -------------------------------------------------------------------------------- /Classes/PFNavigationDropdownMenu.bundle/arrow_down_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectFreeze/PFNavigationDropdownMenu/346337ee253135f2c378c414b5e8243b0896b3ab/Classes/PFNavigationDropdownMenu.bundle/arrow_down_icon@2x.png -------------------------------------------------------------------------------- /Classes/PFNavigationDropdownMenu.bundle/arrow_down_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectFreeze/PFNavigationDropdownMenu/346337ee253135f2c378c414b5e8243b0896b3ab/Classes/PFNavigationDropdownMenu.bundle/arrow_down_icon@3x.png -------------------------------------------------------------------------------- /Classes/PFNavigationDropdownMenu.bundle/checkmark_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectFreeze/PFNavigationDropdownMenu/346337ee253135f2c378c414b5e8243b0896b3ab/Classes/PFNavigationDropdownMenu.bundle/checkmark_icon.png -------------------------------------------------------------------------------- /Classes/PFNavigationDropdownMenu.bundle/checkmark_icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectFreeze/PFNavigationDropdownMenu/346337ee253135f2c378c414b5e8243b0896b3ab/Classes/PFNavigationDropdownMenu.bundle/checkmark_icon@2x.png -------------------------------------------------------------------------------- /Classes/PFNavigationDropdownMenu.bundle/checkmark_icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PerfectFreeze/PFNavigationDropdownMenu/346337ee253135f2c378c414b5e8243b0896b3ab/Classes/PFNavigationDropdownMenu.bundle/checkmark_icon@3x.png -------------------------------------------------------------------------------- /Classes/PFNavigationDropdownMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // PFNavigationDropdownMenu.h 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PFNavigationDropdownMenu : UIView 12 | @property (nonatomic, assign) CGFloat cellHeight; 13 | @property (nonatomic, strong) UIColor *cellBackgroundColor; 14 | @property (nonatomic, strong) UIColor *cellTextLabelColor; 15 | @property (nonatomic, strong) UIFont *cellTextLabelFont; 16 | @property (nonatomic, strong) UIColor *cellSelectionColor; 17 | @property (nonatomic, strong) UIImage *checkMarkImage; 18 | @property (nonatomic, strong) UIImage *arrowImage; 19 | @property (nonatomic, assign) CGFloat arrowPadding; 20 | @property (nonatomic, assign) NSTimeInterval animationDuration; 21 | @property (nonatomic, strong) UIColor *maskBackgroundColor; 22 | @property (nonatomic, assign) CGFloat maskBackgroundOpacity; 23 | @property (nonatomic, copy) void(^didSelectItemAtIndexHandler)(NSUInteger indexPath); 24 | 25 | - (instancetype)initWithFrame:(CGRect)frame 26 | title:(NSString *)title 27 | items:(NSArray *)items 28 | containerView:(UIView *)containerView; 29 | @end 30 | -------------------------------------------------------------------------------- /Classes/PFNavigationDropdownMenu.m: -------------------------------------------------------------------------------- 1 | // 2 | // PFNavigationDropdownMenu.m 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "PFNavigationDropdownMenu.h" 10 | #import "PFTableView.h" 11 | 12 | @interface PFNavigationDropdownMenu() 13 | @property (nonatomic, strong) UIView *tableContainerView; 14 | @property (nonatomic, strong) PFConfiguration *configuration; 15 | @property (nonatomic, assign) CGRect mainScreenBounds; 16 | @property (nonatomic, strong) UIButton *menuButton; 17 | @property (nonatomic, strong) UILabel *menuTitle; 18 | @property (nonatomic, strong) UIImageView *menuArrow; 19 | @property (nonatomic, strong) UIView *backgroundView; 20 | @property (nonatomic, strong) PFTableView *tableView; 21 | @property (nonatomic, strong) NSArray *items; 22 | @property (nonatomic, assign) BOOL isShown; 23 | @property (nonatomic, assign) CGFloat navigationBarHeight; 24 | @end 25 | 26 | @implementation PFNavigationDropdownMenu 27 | 28 | - (instancetype)initWithFrame:(CGRect)frame 29 | title:(NSString *)title 30 | items:(NSArray *)items 31 | containerView:(UIView *)containerView 32 | { 33 | self = [super initWithFrame:frame]; 34 | if (self) { 35 | // Init properties 36 | self.configuration = [[PFConfiguration alloc] init]; 37 | self.tableContainerView = containerView; 38 | self.navigationBarHeight = 44; 39 | self.mainScreenBounds = [UIScreen mainScreen].bounds; 40 | self.isShown = NO; 41 | self.items = items; 42 | 43 | // Init button as navigation title 44 | self.menuButton = [[UIButton alloc] initWithFrame:frame]; 45 | [self.menuButton addTarget:self action:@selector(menuButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; 46 | [self addSubview:self.menuButton]; 47 | 48 | self.menuTitle = [[UILabel alloc] initWithFrame:frame]; 49 | self.menuTitle.text = title; 50 | self.menuTitle.textColor = [UINavigationBar appearance].titleTextAttributes[NSForegroundColorAttributeName]; 51 | self.menuTitle.textAlignment = NSTextAlignmentCenter; 52 | self.menuTitle.font = self.configuration.cellTextLabelFont; 53 | [self.menuButton addSubview:self.menuTitle]; 54 | 55 | self.menuArrow = [[UIImageView alloc] initWithImage:self.configuration.arrowImage]; 56 | [self.menuButton addSubview:self.menuArrow]; 57 | 58 | // Init table view 59 | self.tableView = [[PFTableView alloc] initWithFrame:CGRectMake(self.mainScreenBounds.origin.x, 60 | self.mainScreenBounds.origin.y, 61 | self.mainScreenBounds.size.width, 62 | self.mainScreenBounds.size.height + 300 - 64) 63 | items:items 64 | configuration:self.configuration]; 65 | __weak typeof(self) weakSelf = self; 66 | self.tableView.selectRowAtIndexPathHandler = ^(NSUInteger indexPath){ 67 | __strong typeof(weakSelf) strongSelf = weakSelf; 68 | strongSelf.didSelectItemAtIndexHandler(indexPath); 69 | [strongSelf setMenuTitleText:items[indexPath]]; 70 | [strongSelf hideMenu]; 71 | strongSelf.isShown = NO; 72 | [strongSelf layoutSubviews]; 73 | }; 74 | 75 | } 76 | return self; 77 | } 78 | 79 | - (void)layoutSubviews 80 | { 81 | [super layoutSubviews]; 82 | [self.menuTitle sizeToFit]; 83 | self.menuTitle.center = CGPointMake(self.frame.size.width / 2.f, self.frame.size.height / 2.f); 84 | [self.menuArrow sizeToFit]; 85 | self.menuArrow.center = CGPointMake(CGRectGetMaxX(self.menuTitle.frame) + self.configuration.arrowPadding, self.frame.size.height / 2.f); 86 | } 87 | 88 | - (void)showMenu 89 | { 90 | // Table view header 91 | UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 300)]; 92 | headerView.backgroundColor = self.configuration.cellBackgroundColor; 93 | self.tableView.tableHeaderView = headerView; 94 | 95 | // Reload data to dismiss highlight color of selected cell 96 | [self.tableView reloadData]; 97 | 98 | // Init background view (under table view) 99 | self.backgroundView = [[UIView alloc] initWithFrame:self.mainScreenBounds]; 100 | self.backgroundView.backgroundColor = self.configuration.maskBackgroundColor; 101 | 102 | // Add background view & table view to container view 103 | [self.tableContainerView addSubview:self.backgroundView]; 104 | [self.tableContainerView addSubview:self.tableView]; 105 | 106 | // Rotate arrow 107 | [self rotateArrow]; 108 | 109 | // Change background alpha 110 | self.backgroundView.alpha = 0; 111 | 112 | // Animation 113 | self.tableView.frame = CGRectMake(self.tableView.frame.origin.x, 114 | -(CGFloat)(self.items.count) * self.configuration.cellHeight - 300, 115 | self.tableView.frame.size.width, 116 | self.tableView.frame.size.height); 117 | 118 | [UIView animateWithDuration:self.configuration.animationDuration * 1.5f 119 | delay:0 120 | usingSpringWithDamping:.7 121 | initialSpringVelocity:.5 122 | options:0 123 | animations:^{ 124 | self.tableView.frame = CGRectMake(self.tableView.frame.origin.x, 125 | -300, 126 | self.tableView.frame.size.width, 127 | self.tableView.frame.size.height); 128 | self.backgroundView.alpha = self.configuration.maskBackgroundOpacity; 129 | 130 | } 131 | completion:nil]; 132 | } 133 | 134 | - (void)hideMenu 135 | { 136 | // Rotate arrow 137 | [self rotateArrow]; 138 | 139 | // Change background alpha 140 | self.backgroundView.alpha = self.configuration.maskBackgroundOpacity; 141 | 142 | [UIView animateWithDuration:self.configuration.animationDuration * 1.5f 143 | delay:0 144 | usingSpringWithDamping:.7 145 | initialSpringVelocity:.5 146 | options:0 147 | animations:^{ 148 | self.tableView.frame = CGRectMake(self.tableView.frame.origin.x, 149 | -200, 150 | self.tableView.frame.size.width, 151 | self.tableView.frame.size.height); 152 | self.backgroundView.alpha = self.configuration.maskBackgroundOpacity; 153 | 154 | } 155 | completion:nil]; 156 | 157 | [UIView animateWithDuration:self.configuration.animationDuration 158 | delay:0 159 | options:UIViewAnimationOptionTransitionNone 160 | animations:^{ 161 | self.tableView.frame = CGRectMake(self.tableView.frame.origin.x, 162 | -(CGFloat)(self.items.count) * self.configuration.cellHeight - 300, 163 | self.tableView.frame.size.width, 164 | self.tableView.frame.size.height); 165 | self.backgroundView.alpha = 0; 166 | } completion:^(BOOL finished) { 167 | [self.tableView removeFromSuperview]; 168 | [self.backgroundView removeFromSuperview]; 169 | }]; 170 | 171 | } 172 | 173 | - (void)rotateArrow 174 | { 175 | __weak typeof(self) weakSelf = self; 176 | [UIView animateWithDuration:self.configuration.animationDuration 177 | animations:^{ 178 | __strong typeof(weakSelf) strongSelf = weakSelf; 179 | strongSelf.menuArrow.transform = CGAffineTransformRotate(strongSelf.menuArrow.transform, 180 * (CGFloat)(M_PI / 180)); 180 | }]; 181 | } 182 | 183 | - (void)setMenuTitleText:(NSString *)title 184 | { 185 | self.menuTitle.text = title; 186 | } 187 | 188 | - (void)menuButtonTapped:(UIButton *)sender 189 | { 190 | self.isShown = !self.isShown; 191 | if (self.isShown) { 192 | [self showMenu]; 193 | } else { 194 | [self hideMenu]; 195 | } 196 | } 197 | 198 | #pragma mark - Setters 199 | - (void)setCellHeight:(CGFloat)cellHeight 200 | { 201 | self.configuration.cellHeight = cellHeight; 202 | } 203 | 204 | - (void)setCellBackgroundColor:(UIColor *)cellBackgroundColor 205 | { 206 | self.configuration.cellBackgroundColor = cellBackgroundColor; 207 | } 208 | 209 | - (void)setCellTextLabelColor:(UIColor *)cellTextLabelColor 210 | { 211 | self.configuration.cellTextLabelColor = cellTextLabelColor; 212 | } 213 | 214 | - (void)setCellTextLabelFont:(UIFont *)cellTextLabelFont 215 | { 216 | self.configuration.cellTextLabelFont = cellTextLabelFont; 217 | self.menuTitle.font = self.configuration.cellTextLabelFont; 218 | } 219 | 220 | - (void)setCellSelectionColor:(UIColor *)cellSelectionColor 221 | { 222 | self.configuration.cellSelectionColor = cellSelectionColor; 223 | } 224 | 225 | - (void)setCheckMarkImage:(UIImage *)checkMarkImage 226 | { 227 | self.configuration.checkMarkImage = checkMarkImage; 228 | } 229 | 230 | - (void)setAnimationDuration:(NSTimeInterval)animationDuration 231 | { 232 | self.configuration.animationDuration = animationDuration; 233 | } 234 | 235 | - (void)setArrowImage:(UIImage *)arrowImage 236 | { 237 | self.configuration.arrowImage = arrowImage; 238 | self.menuArrow.image = self.configuration.arrowImage; 239 | } 240 | 241 | - (void)setArrowPadding:(CGFloat)arrowPadding 242 | { 243 | self.configuration.arrowPadding = arrowPadding; 244 | } 245 | 246 | - (void)setMaskBackgroundColor:(UIColor *)maskBackgroundColor 247 | { 248 | self.configuration.maskBackgroundColor = maskBackgroundColor; 249 | } 250 | 251 | - (void)setMaskBackgroundOpacity:(CGFloat)maskBackgroundOpacity 252 | { 253 | self.configuration.maskBackgroundOpacity = maskBackgroundOpacity; 254 | } 255 | @end 256 | -------------------------------------------------------------------------------- /Classes/PFTableCellContentView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PFTableCellContentView.h 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PFTableCellContentView : UIView 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Classes/PFTableCellContentView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PFTableCellContentView.m 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "PFTableCellContentView.h" 10 | 11 | @implementation PFTableCellContentView 12 | 13 | // Only override drawRect: if you perform custom drawing. 14 | // An empty implementation adversely affects performance during animation. 15 | - (void)drawRect:(CGRect)rect { 16 | // Drawing code 17 | [super drawRect:rect]; 18 | CGContextRef context = UIGraphicsGetCurrentContext(); 19 | // Set separator color of dropdown menu based on barStyle 20 | if ([UINavigationBar appearance].barStyle == UIBarStyleDefault) { 21 | CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.4); 22 | } else { 23 | CGContextSetRGBStrokeColor(context, 1, 1, 1, 0.3); 24 | } 25 | CGContextSetLineWidth(context, 1); 26 | CGContextMoveToPoint(context, 0, self.bounds.size.height); 27 | CGContextAddLineToPoint(context, self.bounds.size.width, self.bounds.size.height); 28 | CGContextStrokePath(context); 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Classes/PFTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PFTableView.h 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PFConfiguration.h" 11 | 12 | @interface PFTableView : UITableView 13 | @property (nonatomic, strong) PFConfiguration *configuration; 14 | @property (nonatomic, copy) void(^selectRowAtIndexPathHandler)(NSUInteger indexPath); 15 | 16 | - (instancetype)initWithFrame:(CGRect)frame items:(NSArray *)items configuration:(PFConfiguration *)configuration; 17 | @end 18 | -------------------------------------------------------------------------------- /Classes/PFTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PFTableView.m 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "PFTableView.h" 10 | #import "PFTableViewCell.h" 11 | 12 | @interface PFTableView () 13 | @property (nonatomic, strong) NSArray *items; 14 | @property (nonatomic, assign) NSUInteger selectedIndexPath; 15 | @end 16 | 17 | 18 | @implementation PFTableView 19 | - (instancetype)initWithFrame:(CGRect)frame items:(NSArray *)items configuration:(PFConfiguration *)configuration 20 | { 21 | self = [super initWithFrame:frame style:UITableViewStylePlain]; 22 | if (self) { 23 | self.items = items; 24 | self.selectedIndexPath = 0; 25 | self.configuration = configuration; 26 | 27 | // Setup table view 28 | self.delegate = self; 29 | self.dataSource = self; 30 | self.backgroundColor = [UIColor clearColor]; 31 | self.separatorStyle = UITableViewCellSeparatorStyleNone; 32 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth; 33 | self.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero]; 34 | } 35 | return self; 36 | } 37 | 38 | #pragma mark - UITableViewDataSource 39 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 40 | { 41 | return 1; 42 | } 43 | 44 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 45 | { 46 | return self.items.count; 47 | } 48 | 49 | - (CGFloat)tableView:(UITableView *)tableView estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath 50 | { 51 | return self.configuration.cellHeight; 52 | } 53 | 54 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 55 | { 56 | return self.configuration.cellHeight; 57 | } 58 | 59 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 60 | { 61 | PFTableViewCell *cell = [[PFTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 62 | reuseIdentifier:@"Cell" 63 | configuration:self.configuration]; 64 | cell.textLabel.text = self.items[indexPath.row]; 65 | if (indexPath.row == self.selectedIndexPath) { 66 | cell.checkmarkIcon.hidden = NO; 67 | } else { 68 | cell.checkmarkIcon.hidden = YES; 69 | } 70 | return cell; 71 | } 72 | 73 | #pragma mark - UITableViewDelegate 74 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 75 | { 76 | self.selectedIndexPath = indexPath.row; 77 | self.selectRowAtIndexPathHandler(indexPath.row); 78 | [self reloadData]; 79 | PFTableViewCell *cell = (PFTableViewCell *)[tableView cellForRowAtIndexPath:indexPath]; 80 | cell.contentView.backgroundColor = self.configuration.cellSelectionColor; 81 | } 82 | 83 | - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath 84 | { 85 | PFTableViewCell *cell = (PFTableViewCell *)[tableView cellForRowAtIndexPath:indexPath]; 86 | cell.checkmarkIcon.hidden = YES; 87 | cell.contentView.backgroundColor = self.configuration.cellBackgroundColor; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /Classes/PFTableViewCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PFTableViewCell.h 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PFConfiguration.h" 11 | 12 | @interface PFTableViewCell : UITableViewCell 13 | @property (nonatomic, strong) UIImageView *checkmarkIcon; 14 | @property (nonatomic, assign) CGRect cellContentFrame; 15 | @property (nonatomic, strong) PFConfiguration *configuration; 16 | 17 | - (instancetype)initWithStyle:(UITableViewCellStyle)style 18 | reuseIdentifier:(NSString *)reuseIdentifier 19 | configuration:(PFConfiguration *)configuration; 20 | @end 21 | -------------------------------------------------------------------------------- /Classes/PFTableViewCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // PFTableViewCell.m 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "PFTableViewCell.h" 10 | #import "PFTableCellContentView.h" 11 | 12 | @implementation PFTableViewCell 13 | 14 | - (instancetype)initWithStyle:(UITableViewCellStyle)style 15 | reuseIdentifier:(NSString *)reuseIdentifier 16 | configuration:(PFConfiguration *)configuration 17 | { 18 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; 19 | if (self) { 20 | self.configuration = configuration; 21 | 22 | // Setup cell 23 | self.cellContentFrame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, self.configuration.cellHeight); 24 | self.contentView.backgroundColor = self.configuration.cellBackgroundColor; 25 | self.selectionStyle = UITableViewCellSelectionStyleNone; 26 | self.textLabel.textAlignment = NSTextAlignmentLeft; 27 | self.textLabel.textColor = self.configuration.cellTextLabelColor; 28 | self.textLabel.font = self.configuration.cellTextLabelFont; 29 | self.textLabel.frame = CGRectMake(20, 0, self.cellContentFrame.size.width, self.cellContentFrame.size.height); 30 | 31 | // Checkmark icon 32 | self.checkmarkIcon = [[UIImageView alloc] initWithFrame:CGRectMake(self.cellContentFrame.size.width - 50, (self.cellContentFrame.size.height - 30)/2, 30, 30)]; 33 | self.checkmarkIcon.hidden = YES; 34 | self.checkmarkIcon.image = self.configuration.checkMarkImage; 35 | self.checkmarkIcon.contentMode = UIViewContentModeScaleAspectFill; 36 | [self.contentView addSubview:self.checkmarkIcon]; 37 | 38 | // Separator for cell 39 | PFTableCellContentView *separator = [[PFTableCellContentView alloc] initWithFrame:self.cellContentFrame]; 40 | separator.backgroundColor = [UIColor clearColor]; 41 | [self.contentView addSubview:separator]; 42 | } 43 | return self; 44 | } 45 | 46 | - (void)layoutSubviews 47 | { 48 | [super layoutSubviews]; 49 | self.bounds = self.cellContentFrame; 50 | self.contentView.frame = self.bounds; 51 | } 52 | @end 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Cee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "PFNavigationDropdownMenu" 3 | s.version = "0.1.1" 4 | s.summary = "The Objective-C version of BTNavigationDropdownMenu. Supports iOS 7.0+." 5 | s.description = <<-DESC 6 | The elegant **dropdown menu**, written in Objective-C, appears underneath **navigation bar** to display a list of related items when a user click on the navigation title. Supports iOS 7.0+. 7 | DESC 8 | 9 | s.homepage = "https://github.com/PerfectFreeze/PFNavigationDropdownMenu" 10 | 11 | s.license = { :type => "MIT", :file => "LICENSE" } 12 | 13 | s.author = { "Cee" => "cee@chu2byo.com" } 14 | 15 | s.platform = :ios, '7.0' 16 | 17 | s.source = { :git => "https://github.com/PerfectFreeze/PFNavigationDropdownMenu.git", :tag => "v#{s.version.to_s}" } 18 | 19 | s.source_files = "Classes", "Classes/**/*.{h,m}" 20 | s.resources = "Classes/*.bundle" 21 | s.requires_arc = true 22 | end -------------------------------------------------------------------------------- /PFNavigationDropdownMenu.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9211C2311B6E0BDD00623B91 /* PFConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 9211C2271B6E0BDD00623B91 /* PFConfiguration.m */; }; 11 | 9211C2321B6E0BDD00623B91 /* PFNavigationDropdownMenu.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 9211C2281B6E0BDD00623B91 /* PFNavigationDropdownMenu.bundle */; }; 12 | 9211C2331B6E0BDD00623B91 /* PFNavigationDropdownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 9211C22A1B6E0BDD00623B91 /* PFNavigationDropdownMenu.m */; }; 13 | 9211C2341B6E0BDD00623B91 /* PFTableCellContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9211C22C1B6E0BDD00623B91 /* PFTableCellContentView.m */; }; 14 | 9211C2351B6E0BDD00623B91 /* PFTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9211C22E1B6E0BDD00623B91 /* PFTableView.m */; }; 15 | 9211C2361B6E0BDD00623B91 /* PFTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9211C2301B6E0BDD00623B91 /* PFTableViewCell.m */; }; 16 | 92E1F1191B6DB0E5005C3C51 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E1F1181B6DB0E5005C3C51 /* main.m */; }; 17 | 92E1F11C1B6DB0E5005C3C51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E1F11B1B6DB0E5005C3C51 /* AppDelegate.m */; }; 18 | 92E1F11F1B6DB0E5005C3C51 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E1F11E1B6DB0E5005C3C51 /* ViewController.m */; }; 19 | 92E1F1221B6DB0E5005C3C51 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 92E1F1201B6DB0E5005C3C51 /* Main.storyboard */; }; 20 | 92E1F1241B6DB0E5005C3C51 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 92E1F1231B6DB0E5005C3C51 /* Images.xcassets */; }; 21 | 92E1F1271B6DB0E5005C3C51 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 92E1F1251B6DB0E5005C3C51 /* LaunchScreen.xib */; }; 22 | 92E1F1331B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 92E1F1321B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 92E1F12D1B6DB0E5005C3C51 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 92E1F10B1B6DB0E5005C3C51 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 92E1F1121B6DB0E5005C3C51; 31 | remoteInfo = PFNavigationDropdownMenu; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | 79F5CDACBDB6E16D368B706A /* Pods-PFNavigationDropdownMenu.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PFNavigationDropdownMenu.release.xcconfig"; path = "Pods/Target Support Files/Pods-PFNavigationDropdownMenu/Pods-PFNavigationDropdownMenu.release.xcconfig"; sourceTree = ""; }; 37 | 9211C2261B6E0BDD00623B91 /* PFConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFConfiguration.h; sourceTree = ""; }; 38 | 9211C2271B6E0BDD00623B91 /* PFConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFConfiguration.m; sourceTree = ""; }; 39 | 9211C2281B6E0BDD00623B91 /* PFNavigationDropdownMenu.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = PFNavigationDropdownMenu.bundle; sourceTree = ""; }; 40 | 9211C2291B6E0BDD00623B91 /* PFNavigationDropdownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFNavigationDropdownMenu.h; sourceTree = ""; }; 41 | 9211C22A1B6E0BDD00623B91 /* PFNavigationDropdownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFNavigationDropdownMenu.m; sourceTree = ""; }; 42 | 9211C22B1B6E0BDD00623B91 /* PFTableCellContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFTableCellContentView.h; sourceTree = ""; }; 43 | 9211C22C1B6E0BDD00623B91 /* PFTableCellContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFTableCellContentView.m; sourceTree = ""; }; 44 | 9211C22D1B6E0BDD00623B91 /* PFTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFTableView.h; sourceTree = ""; }; 45 | 9211C22E1B6E0BDD00623B91 /* PFTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFTableView.m; sourceTree = ""; }; 46 | 9211C22F1B6E0BDD00623B91 /* PFTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PFTableViewCell.h; sourceTree = ""; }; 47 | 9211C2301B6E0BDD00623B91 /* PFTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PFTableViewCell.m; sourceTree = ""; }; 48 | 92E1F1131B6DB0E5005C3C51 /* PFNavigationDropdownMenu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PFNavigationDropdownMenu.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 92E1F1171B6DB0E5005C3C51 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 92E1F1181B6DB0E5005C3C51 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 51 | 92E1F11A1B6DB0E5005C3C51 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 52 | 92E1F11B1B6DB0E5005C3C51 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 53 | 92E1F11D1B6DB0E5005C3C51 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 54 | 92E1F11E1B6DB0E5005C3C51 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55 | 92E1F1211B6DB0E5005C3C51 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 56 | 92E1F1231B6DB0E5005C3C51 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 57 | 92E1F1261B6DB0E5005C3C51 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 58 | 92E1F12C1B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PFNavigationDropdownMenuTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 59 | 92E1F1311B6DB0E5005C3C51 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 60 | 92E1F1321B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PFNavigationDropdownMenuTests.m; sourceTree = ""; }; 61 | 991BFB9895C92D77778905B3 /* libPods-PFNavigationDropdownMenu.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-PFNavigationDropdownMenu.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 62 | FF256D704C3520A7A768C06D /* Pods-PFNavigationDropdownMenu.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PFNavigationDropdownMenu.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PFNavigationDropdownMenu/Pods-PFNavigationDropdownMenu.debug.xcconfig"; sourceTree = ""; }; 63 | /* End PBXFileReference section */ 64 | 65 | /* Begin PBXFrameworksBuildPhase section */ 66 | 92E1F1101B6DB0E5005C3C51 /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | 92E1F1291B6DB0E5005C3C51 /* Frameworks */ = { 74 | isa = PBXFrameworksBuildPhase; 75 | buildActionMask = 2147483647; 76 | files = ( 77 | ); 78 | runOnlyForDeploymentPostprocessing = 0; 79 | }; 80 | /* End PBXFrameworksBuildPhase section */ 81 | 82 | /* Begin PBXGroup section */ 83 | 65FEC17D113CE295952ECEE3 /* Pods */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | FF256D704C3520A7A768C06D /* Pods-PFNavigationDropdownMenu.debug.xcconfig */, 87 | 79F5CDACBDB6E16D368B706A /* Pods-PFNavigationDropdownMenu.release.xcconfig */, 88 | ); 89 | name = Pods; 90 | sourceTree = ""; 91 | }; 92 | 9211C2251B6E0BDD00623B91 /* Classes */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 9211C2261B6E0BDD00623B91 /* PFConfiguration.h */, 96 | 9211C2271B6E0BDD00623B91 /* PFConfiguration.m */, 97 | 9211C2281B6E0BDD00623B91 /* PFNavigationDropdownMenu.bundle */, 98 | 9211C2291B6E0BDD00623B91 /* PFNavigationDropdownMenu.h */, 99 | 9211C22A1B6E0BDD00623B91 /* PFNavigationDropdownMenu.m */, 100 | 9211C22B1B6E0BDD00623B91 /* PFTableCellContentView.h */, 101 | 9211C22C1B6E0BDD00623B91 /* PFTableCellContentView.m */, 102 | 9211C22D1B6E0BDD00623B91 /* PFTableView.h */, 103 | 9211C22E1B6E0BDD00623B91 /* PFTableView.m */, 104 | 9211C22F1B6E0BDD00623B91 /* PFTableViewCell.h */, 105 | 9211C2301B6E0BDD00623B91 /* PFTableViewCell.m */, 106 | ); 107 | path = Classes; 108 | sourceTree = SOURCE_ROOT; 109 | }; 110 | 92E1F10A1B6DB0E5005C3C51 = { 111 | isa = PBXGroup; 112 | children = ( 113 | 92E1F1151B6DB0E5005C3C51 /* PFNavigationDropdownMenu */, 114 | 92E1F12F1B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests */, 115 | 92E1F1141B6DB0E5005C3C51 /* Products */, 116 | 65FEC17D113CE295952ECEE3 /* Pods */, 117 | 9CCAC9353054134A31661EA3 /* Frameworks */, 118 | ); 119 | sourceTree = ""; 120 | }; 121 | 92E1F1141B6DB0E5005C3C51 /* Products */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 92E1F1131B6DB0E5005C3C51 /* PFNavigationDropdownMenu.app */, 125 | 92E1F12C1B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests.xctest */, 126 | ); 127 | name = Products; 128 | sourceTree = ""; 129 | }; 130 | 92E1F1151B6DB0E5005C3C51 /* PFNavigationDropdownMenu */ = { 131 | isa = PBXGroup; 132 | children = ( 133 | 92E1F11A1B6DB0E5005C3C51 /* AppDelegate.h */, 134 | 92E1F11B1B6DB0E5005C3C51 /* AppDelegate.m */, 135 | 92E1F11D1B6DB0E5005C3C51 /* ViewController.h */, 136 | 92E1F11E1B6DB0E5005C3C51 /* ViewController.m */, 137 | 92E1F1201B6DB0E5005C3C51 /* Main.storyboard */, 138 | 9211C2251B6E0BDD00623B91 /* Classes */, 139 | 92E1F1231B6DB0E5005C3C51 /* Images.xcassets */, 140 | 92E1F1251B6DB0E5005C3C51 /* LaunchScreen.xib */, 141 | 92E1F1161B6DB0E5005C3C51 /* Supporting Files */, 142 | ); 143 | path = PFNavigationDropdownMenu; 144 | sourceTree = ""; 145 | }; 146 | 92E1F1161B6DB0E5005C3C51 /* Supporting Files */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 92E1F1171B6DB0E5005C3C51 /* Info.plist */, 150 | 92E1F1181B6DB0E5005C3C51 /* main.m */, 151 | ); 152 | name = "Supporting Files"; 153 | sourceTree = ""; 154 | }; 155 | 92E1F12F1B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests */ = { 156 | isa = PBXGroup; 157 | children = ( 158 | 92E1F1321B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests.m */, 159 | 92E1F1301B6DB0E5005C3C51 /* Supporting Files */, 160 | ); 161 | path = PFNavigationDropdownMenuTests; 162 | sourceTree = ""; 163 | }; 164 | 92E1F1301B6DB0E5005C3C51 /* Supporting Files */ = { 165 | isa = PBXGroup; 166 | children = ( 167 | 92E1F1311B6DB0E5005C3C51 /* Info.plist */, 168 | ); 169 | name = "Supporting Files"; 170 | sourceTree = ""; 171 | }; 172 | 9CCAC9353054134A31661EA3 /* Frameworks */ = { 173 | isa = PBXGroup; 174 | children = ( 175 | 991BFB9895C92D77778905B3 /* libPods-PFNavigationDropdownMenu.a */, 176 | ); 177 | name = Frameworks; 178 | sourceTree = ""; 179 | }; 180 | /* End PBXGroup section */ 181 | 182 | /* Begin PBXNativeTarget section */ 183 | 92E1F1121B6DB0E5005C3C51 /* PFNavigationDropdownMenu */ = { 184 | isa = PBXNativeTarget; 185 | buildConfigurationList = 92E1F1361B6DB0E5005C3C51 /* Build configuration list for PBXNativeTarget "PFNavigationDropdownMenu" */; 186 | buildPhases = ( 187 | 92E1F10F1B6DB0E5005C3C51 /* Sources */, 188 | 92E1F1101B6DB0E5005C3C51 /* Frameworks */, 189 | 92E1F1111B6DB0E5005C3C51 /* Resources */, 190 | ); 191 | buildRules = ( 192 | ); 193 | dependencies = ( 194 | ); 195 | name = PFNavigationDropdownMenu; 196 | productName = PFNavigationDropdownMenu; 197 | productReference = 92E1F1131B6DB0E5005C3C51 /* PFNavigationDropdownMenu.app */; 198 | productType = "com.apple.product-type.application"; 199 | }; 200 | 92E1F12B1B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests */ = { 201 | isa = PBXNativeTarget; 202 | buildConfigurationList = 92E1F1391B6DB0E5005C3C51 /* Build configuration list for PBXNativeTarget "PFNavigationDropdownMenuTests" */; 203 | buildPhases = ( 204 | 92E1F1281B6DB0E5005C3C51 /* Sources */, 205 | 92E1F1291B6DB0E5005C3C51 /* Frameworks */, 206 | 92E1F12A1B6DB0E5005C3C51 /* Resources */, 207 | ); 208 | buildRules = ( 209 | ); 210 | dependencies = ( 211 | 92E1F12E1B6DB0E5005C3C51 /* PBXTargetDependency */, 212 | ); 213 | name = PFNavigationDropdownMenuTests; 214 | productName = PFNavigationDropdownMenuTests; 215 | productReference = 92E1F12C1B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests.xctest */; 216 | productType = "com.apple.product-type.bundle.unit-test"; 217 | }; 218 | /* End PBXNativeTarget section */ 219 | 220 | /* Begin PBXProject section */ 221 | 92E1F10B1B6DB0E5005C3C51 /* Project object */ = { 222 | isa = PBXProject; 223 | attributes = { 224 | CLASSPREFIX = PF; 225 | LastUpgradeCheck = 0640; 226 | ORGANIZATIONNAME = Cee; 227 | TargetAttributes = { 228 | 92E1F1121B6DB0E5005C3C51 = { 229 | CreatedOnToolsVersion = 6.4; 230 | }; 231 | 92E1F12B1B6DB0E5005C3C51 = { 232 | CreatedOnToolsVersion = 6.4; 233 | TestTargetID = 92E1F1121B6DB0E5005C3C51; 234 | }; 235 | }; 236 | }; 237 | buildConfigurationList = 92E1F10E1B6DB0E5005C3C51 /* Build configuration list for PBXProject "PFNavigationDropdownMenu" */; 238 | compatibilityVersion = "Xcode 3.2"; 239 | developmentRegion = English; 240 | hasScannedForEncodings = 0; 241 | knownRegions = ( 242 | en, 243 | Base, 244 | ); 245 | mainGroup = 92E1F10A1B6DB0E5005C3C51; 246 | productRefGroup = 92E1F1141B6DB0E5005C3C51 /* Products */; 247 | projectDirPath = ""; 248 | projectRoot = ""; 249 | targets = ( 250 | 92E1F1121B6DB0E5005C3C51 /* PFNavigationDropdownMenu */, 251 | 92E1F12B1B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests */, 252 | ); 253 | }; 254 | /* End PBXProject section */ 255 | 256 | /* Begin PBXResourcesBuildPhase section */ 257 | 92E1F1111B6DB0E5005C3C51 /* Resources */ = { 258 | isa = PBXResourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | 92E1F1221B6DB0E5005C3C51 /* Main.storyboard in Resources */, 262 | 92E1F1271B6DB0E5005C3C51 /* LaunchScreen.xib in Resources */, 263 | 92E1F1241B6DB0E5005C3C51 /* Images.xcassets in Resources */, 264 | 9211C2321B6E0BDD00623B91 /* PFNavigationDropdownMenu.bundle in Resources */, 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | 92E1F12A1B6DB0E5005C3C51 /* Resources */ = { 269 | isa = PBXResourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | /* End PBXResourcesBuildPhase section */ 276 | 277 | /* Begin PBXSourcesBuildPhase section */ 278 | 92E1F10F1B6DB0E5005C3C51 /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 92E1F11F1B6DB0E5005C3C51 /* ViewController.m in Sources */, 283 | 9211C2351B6E0BDD00623B91 /* PFTableView.m in Sources */, 284 | 9211C2341B6E0BDD00623B91 /* PFTableCellContentView.m in Sources */, 285 | 92E1F11C1B6DB0E5005C3C51 /* AppDelegate.m in Sources */, 286 | 9211C2331B6E0BDD00623B91 /* PFNavigationDropdownMenu.m in Sources */, 287 | 9211C2361B6E0BDD00623B91 /* PFTableViewCell.m in Sources */, 288 | 9211C2311B6E0BDD00623B91 /* PFConfiguration.m in Sources */, 289 | 92E1F1191B6DB0E5005C3C51 /* main.m in Sources */, 290 | ); 291 | runOnlyForDeploymentPostprocessing = 0; 292 | }; 293 | 92E1F1281B6DB0E5005C3C51 /* Sources */ = { 294 | isa = PBXSourcesBuildPhase; 295 | buildActionMask = 2147483647; 296 | files = ( 297 | 92E1F1331B6DB0E5005C3C51 /* PFNavigationDropdownMenuTests.m in Sources */, 298 | ); 299 | runOnlyForDeploymentPostprocessing = 0; 300 | }; 301 | /* End PBXSourcesBuildPhase section */ 302 | 303 | /* Begin PBXTargetDependency section */ 304 | 92E1F12E1B6DB0E5005C3C51 /* PBXTargetDependency */ = { 305 | isa = PBXTargetDependency; 306 | target = 92E1F1121B6DB0E5005C3C51 /* PFNavigationDropdownMenu */; 307 | targetProxy = 92E1F12D1B6DB0E5005C3C51 /* PBXContainerItemProxy */; 308 | }; 309 | /* End PBXTargetDependency section */ 310 | 311 | /* Begin PBXVariantGroup section */ 312 | 92E1F1201B6DB0E5005C3C51 /* Main.storyboard */ = { 313 | isa = PBXVariantGroup; 314 | children = ( 315 | 92E1F1211B6DB0E5005C3C51 /* Base */, 316 | ); 317 | name = Main.storyboard; 318 | sourceTree = ""; 319 | }; 320 | 92E1F1251B6DB0E5005C3C51 /* LaunchScreen.xib */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | 92E1F1261B6DB0E5005C3C51 /* Base */, 324 | ); 325 | name = LaunchScreen.xib; 326 | sourceTree = ""; 327 | }; 328 | /* End PBXVariantGroup section */ 329 | 330 | /* Begin XCBuildConfiguration section */ 331 | 92E1F1341B6DB0E5005C3C51 /* Debug */ = { 332 | isa = XCBuildConfiguration; 333 | buildSettings = { 334 | ALWAYS_SEARCH_USER_PATHS = NO; 335 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 336 | CLANG_CXX_LIBRARY = "libc++"; 337 | CLANG_ENABLE_MODULES = YES; 338 | CLANG_ENABLE_OBJC_ARC = YES; 339 | CLANG_WARN_BOOL_CONVERSION = YES; 340 | CLANG_WARN_CONSTANT_CONVERSION = YES; 341 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 342 | CLANG_WARN_EMPTY_BODY = YES; 343 | CLANG_WARN_ENUM_CONVERSION = YES; 344 | CLANG_WARN_INT_CONVERSION = YES; 345 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 346 | CLANG_WARN_UNREACHABLE_CODE = YES; 347 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 348 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 349 | COPY_PHASE_STRIP = NO; 350 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 351 | ENABLE_STRICT_OBJC_MSGSEND = YES; 352 | GCC_C_LANGUAGE_STANDARD = gnu99; 353 | GCC_DYNAMIC_NO_PIC = NO; 354 | GCC_NO_COMMON_BLOCKS = YES; 355 | GCC_OPTIMIZATION_LEVEL = 0; 356 | GCC_PREPROCESSOR_DEFINITIONS = ( 357 | "DEBUG=1", 358 | "$(inherited)", 359 | ); 360 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 363 | GCC_WARN_UNDECLARED_SELECTOR = YES; 364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 365 | GCC_WARN_UNUSED_FUNCTION = YES; 366 | GCC_WARN_UNUSED_VARIABLE = YES; 367 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 368 | MTL_ENABLE_DEBUG_INFO = YES; 369 | ONLY_ACTIVE_ARCH = YES; 370 | SDKROOT = iphoneos; 371 | }; 372 | name = Debug; 373 | }; 374 | 92E1F1351B6DB0E5005C3C51 /* Release */ = { 375 | isa = XCBuildConfiguration; 376 | buildSettings = { 377 | ALWAYS_SEARCH_USER_PATHS = NO; 378 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 379 | CLANG_CXX_LIBRARY = "libc++"; 380 | CLANG_ENABLE_MODULES = YES; 381 | CLANG_ENABLE_OBJC_ARC = YES; 382 | CLANG_WARN_BOOL_CONVERSION = YES; 383 | CLANG_WARN_CONSTANT_CONVERSION = YES; 384 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 385 | CLANG_WARN_EMPTY_BODY = YES; 386 | CLANG_WARN_ENUM_CONVERSION = YES; 387 | CLANG_WARN_INT_CONVERSION = YES; 388 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 389 | CLANG_WARN_UNREACHABLE_CODE = YES; 390 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 391 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 392 | COPY_PHASE_STRIP = NO; 393 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 394 | ENABLE_NS_ASSERTIONS = NO; 395 | ENABLE_STRICT_OBJC_MSGSEND = YES; 396 | GCC_C_LANGUAGE_STANDARD = gnu99; 397 | GCC_NO_COMMON_BLOCKS = YES; 398 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 399 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 400 | GCC_WARN_UNDECLARED_SELECTOR = YES; 401 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 402 | GCC_WARN_UNUSED_FUNCTION = YES; 403 | GCC_WARN_UNUSED_VARIABLE = YES; 404 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 405 | MTL_ENABLE_DEBUG_INFO = NO; 406 | SDKROOT = iphoneos; 407 | VALIDATE_PRODUCT = YES; 408 | }; 409 | name = Release; 410 | }; 411 | 92E1F1371B6DB0E5005C3C51 /* Debug */ = { 412 | isa = XCBuildConfiguration; 413 | buildSettings = { 414 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 415 | INFOPLIST_FILE = PFNavigationDropdownMenu/Info.plist; 416 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | PRODUCT_NAME = "$(TARGET_NAME)"; 419 | }; 420 | name = Debug; 421 | }; 422 | 92E1F1381B6DB0E5005C3C51 /* Release */ = { 423 | isa = XCBuildConfiguration; 424 | buildSettings = { 425 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 426 | INFOPLIST_FILE = PFNavigationDropdownMenu/Info.plist; 427 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 428 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 429 | PRODUCT_NAME = "$(TARGET_NAME)"; 430 | }; 431 | name = Release; 432 | }; 433 | 92E1F13A1B6DB0E5005C3C51 /* Debug */ = { 434 | isa = XCBuildConfiguration; 435 | buildSettings = { 436 | BUNDLE_LOADER = "$(TEST_HOST)"; 437 | FRAMEWORK_SEARCH_PATHS = ( 438 | "$(SDKROOT)/Developer/Library/Frameworks", 439 | "$(inherited)", 440 | ); 441 | GCC_PREPROCESSOR_DEFINITIONS = ( 442 | "DEBUG=1", 443 | "$(inherited)", 444 | ); 445 | INFOPLIST_FILE = PFNavigationDropdownMenuTests/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PFNavigationDropdownMenu.app/PFNavigationDropdownMenu"; 449 | }; 450 | name = Debug; 451 | }; 452 | 92E1F13B1B6DB0E5005C3C51 /* Release */ = { 453 | isa = XCBuildConfiguration; 454 | buildSettings = { 455 | BUNDLE_LOADER = "$(TEST_HOST)"; 456 | FRAMEWORK_SEARCH_PATHS = ( 457 | "$(SDKROOT)/Developer/Library/Frameworks", 458 | "$(inherited)", 459 | ); 460 | INFOPLIST_FILE = PFNavigationDropdownMenuTests/Info.plist; 461 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 462 | PRODUCT_NAME = "$(TARGET_NAME)"; 463 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/PFNavigationDropdownMenu.app/PFNavigationDropdownMenu"; 464 | }; 465 | name = Release; 466 | }; 467 | /* End XCBuildConfiguration section */ 468 | 469 | /* Begin XCConfigurationList section */ 470 | 92E1F10E1B6DB0E5005C3C51 /* Build configuration list for PBXProject "PFNavigationDropdownMenu" */ = { 471 | isa = XCConfigurationList; 472 | buildConfigurations = ( 473 | 92E1F1341B6DB0E5005C3C51 /* Debug */, 474 | 92E1F1351B6DB0E5005C3C51 /* Release */, 475 | ); 476 | defaultConfigurationIsVisible = 0; 477 | defaultConfigurationName = Release; 478 | }; 479 | 92E1F1361B6DB0E5005C3C51 /* Build configuration list for PBXNativeTarget "PFNavigationDropdownMenu" */ = { 480 | isa = XCConfigurationList; 481 | buildConfigurations = ( 482 | 92E1F1371B6DB0E5005C3C51 /* Debug */, 483 | 92E1F1381B6DB0E5005C3C51 /* Release */, 484 | ); 485 | defaultConfigurationIsVisible = 0; 486 | defaultConfigurationName = Release; 487 | }; 488 | 92E1F1391B6DB0E5005C3C51 /* Build configuration list for PBXNativeTarget "PFNavigationDropdownMenuTests" */ = { 489 | isa = XCConfigurationList; 490 | buildConfigurations = ( 491 | 92E1F13A1B6DB0E5005C3C51 /* Debug */, 492 | 92E1F13B1B6DB0E5005C3C51 /* Release */, 493 | ); 494 | defaultConfigurationIsVisible = 0; 495 | defaultConfigurationName = Release; 496 | }; 497 | /* End XCConfigurationList section */ 498 | }; 499 | rootObject = 92E1F10B1B6DB0E5005C3C51 /* Project object */; 500 | } 501 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 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 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Cee.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "PFNavigationDropdownMenu.h" 11 | 12 | @interface ViewController () 13 | @property (weak, nonatomic) IBOutlet UILabel *selectedCellLabel; 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | NSArray *items = @[@"Most Popular", @"Latest", @"Trending", @"Nearest", @"Top Picks"]; 21 | self.selectedCellLabel.text = items.firstObject; 22 | self.navigationController.navigationBar.translucent = NO; 23 | self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0/255.0 green:180/255.0 blue:220/255.0 alpha:1.0]; 24 | [UINavigationBar appearance].titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]}; 25 | [UINavigationBar appearance].barStyle = UIBarStyleDefault; 26 | 27 | PFNavigationDropdownMenu *menuView = [[PFNavigationDropdownMenu alloc] initWithFrame:CGRectMake(0, 0, 300, 44) 28 | title:items.firstObject 29 | items:items 30 | containerView:self.view]; 31 | 32 | menuView.cellHeight = 50; 33 | menuView.cellBackgroundColor = self.navigationController.navigationBar.barTintColor; 34 | menuView.cellSelectionColor = [UIColor colorWithRed:0/255.0 green:160/255.0 blue:195/255.0 alpha: 1.0]; 35 | menuView.cellTextLabelColor = [UIColor whiteColor]; 36 | menuView.cellTextLabelFont = [UIFont fontWithName:@"Avenir-Heavy" size:17]; 37 | menuView.arrowPadding = 15; 38 | menuView.animationDuration = 0.5f; 39 | menuView.maskBackgroundColor = [UIColor blackColor]; 40 | menuView.maskBackgroundOpacity = 0.3f; 41 | menuView.didSelectItemAtIndexHandler = ^(NSUInteger indexPath){ 42 | NSLog(@"Did select item at index: %ld", indexPath); 43 | self.selectedCellLabel.text = items[indexPath]; 44 | }; 45 | 46 | self.navigationItem.titleView = menuView; 47 | } 48 | 49 | - (void)didReceiveMemoryWarning { 50 | [super didReceiveMemoryWarning]; 51 | // Dispose of any resources that can be recreated. 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenu/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // PFNavigationDropdownMenu 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenuTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | Cee.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /PFNavigationDropdownMenuTests/PFNavigationDropdownMenuTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // PFNavigationDropdownMenuTests.m 3 | // PFNavigationDropdownMenuTests 4 | // 5 | // Created by Cee on 02/08/2015. 6 | // Copyright (c) 2015 Cee. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface PFNavigationDropdownMenuTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation PFNavigationDropdownMenuTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # PFNavigationDropdownMenu 2 | [![Cocoapods](https://cocoapod-badges.herokuapp.com/v/PFNavigationDropdownMenu/badge.png)](http://cocoapods.org/?q=PFNavigationDropdownMenu) 3 | 4 | The Objective-C version of [BTNavigationDropdownMenu](https://github.com/PhamBaTho/BTNavigationDropdownMenu). Supports iOS 7.0+. 5 | 6 | ## Installation 7 | The simplest option is to use `pod "PFNavigationDropdownMenu"`. 8 | 9 | You can also add the `Classes` folder to your project. There are no further requirements. 10 | 11 | ## Usage 12 | See BTNavigationDropdownMenu [Usage Part](https://github.com/PhamBaTho/BTNavigationDropdownMenu#usage). 13 | 14 | ## Requirement 15 | + iOS 7.0+ 16 | 17 | ## License 18 | Released under the MIT License. --------------------------------------------------------------------------------