├── RW_DropdownMenu ├── demo.gif ├── expandableImage@2x.png ├── ViewController.h ├── TestDropdownViewController.h ├── main.m ├── AppDelegate.h ├── DropdownButton.h ├── CommonDefine.h ├── DropdownMenu.h ├── ConditionDoubleTableView.h ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── Main.storyboard │ └── LaunchScreen.xib ├── Info.plist ├── AppDelegate.m ├── ViewController.m ├── DropdownButton.m ├── DropdownMenu.m ├── TestDropdownViewController.m └── ConditionDoubleTableView.m ├── RW_DropdownMenu.xcodeproj ├── project.xcworkspace │ └── contents.xcworkspacedata └── project.pbxproj ├── .gitignore ├── RW_DropdownMenuTests ├── Info.plist └── RW_DropdownMenuTests.m └── README.md /RW_DropdownMenu/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ryan-Wong-iOS/RW_DropdownMenu/HEAD/RW_DropdownMenu/demo.gif -------------------------------------------------------------------------------- /RW_DropdownMenu/expandableImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Ryan-Wong-iOS/RW_DropdownMenu/HEAD/RW_DropdownMenu/expandableImage@2x.png -------------------------------------------------------------------------------- /RW_DropdownMenu.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /RW_DropdownMenu/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // RW_DropdownMenu 4 | // 5 | // Created by Ryan Wong on 15/9/14. 6 | // Copyright (c) 2015年 RyanWong. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /RW_DropdownMenu/TestDropdownViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestDropdownViewController.h 3 | // Common 4 | // 5 | // Created by Ryan Wong on 15/9/11. 6 | // Copyright (c) 2015年 tenfoldtech. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TestDropdownViewController : UIViewController 12 | 13 | - (id)initWithFrame:(CGRect)frame; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /RW_DropdownMenu/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // RW_DropdownMenu 4 | // 5 | // Created by Ryan Wong on 15/9/14. 6 | // Copyright (c) 2015年 RyanWong. 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 | -------------------------------------------------------------------------------- /RW_DropdownMenu/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // RW_DropdownMenu 4 | // 5 | // Created by Ryan Wong on 15/9/14. 6 | // Copyright (c) 2015年 RyanWong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "ViewController.h" 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (strong, nonatomic) UIWindow *window; 15 | @property (strong, nonatomic) ViewController *viewController; 16 | @property (strong, nonatomic) UINavigationController *nav; 17 | 18 | 19 | @end 20 | 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | *.DS_Store 28 | -------------------------------------------------------------------------------- /RW_DropdownMenu/DropdownButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // DropdownButton.h 3 | // Common 4 | // 5 | // Created by Ryan Wong on 15/9/9. 6 | // Copyright (c) 2015年 tenfoldtech. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @protocol showMenuDelegate 12 | 13 | - (void)showMenu:(NSInteger)index; 14 | - (void)hideMenu; 15 | 16 | @end 17 | 18 | @interface DropdownButton : UIView { 19 | NSInteger _count; 20 | NSInteger _lastTap; 21 | NSString *_lastTapObj; 22 | UIImage *_image; 23 | 24 | BOOL _isButtion; 25 | } 26 | 27 | @property (nonatomic, strong) UIImageView *buttonImageView; 28 | @property (nonatomic, assign) id delegate; 29 | 30 | - (id)initDropdownButtonWithTitles:(NSArray*)titles; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /RW_DropdownMenu/CommonDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // CommonDefine.h 3 | // WPSW2 4 | // 5 | // Created by Ryan Wong on 15/8/18. 6 | // Copyright (c) 2015年 Ryan. All rights reserved. 7 | // 8 | 9 | #pragma mark - Common 10 | //状态栏高度 11 | #define STATUS_BAR_HEIGHT 20 12 | //NavBar高度 13 | #define NAVIGATION_BAR_HEIGHT 44 14 | //状态栏 + 导航栏 高度 15 | #define STATUS_AND_NAVIGATION_HEIGHT ((STATUS_BAR_HEIGHT) + (NAVIGATION_BAR_HEIGHT)) 16 | //屏幕 rect 17 | #define STATUS_AND_NAVIGATION_HEIGHT ((STATUS_BAR_HEIGHT) + (NAVIGATION_BAR_HEIGHT)) 18 | #define SCREEN_RECT ([UIScreen mainScreen].bounds) 19 | #define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width) 20 | #define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height) 21 | #define CONTENT_HEIGHT (SCREEN_HEIGHT - NAVIGATION_BAR_HEIGHT - STATUS_BAR_HEIGHT) -------------------------------------------------------------------------------- /RW_DropdownMenuTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.Ryan.$(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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RW_DropdownMenu 2 | 3 | ### Import 4 | 导入头文件DropdownMenu.h 5 | 6 | ### How To Use 7 | 实现初始化 8 | - (id)initDropdownWithButtonTitles:(NSArray*)titles andLeftListArray:(NSArray*)leftArray andRightListArray:(NSArray *)rightArray; 9 | - 例如: 10 | - DropdownMenu *dropdown = [[DropdownMenu alloc] initDropdownWithButtonTitles:_titleArray andLeftListArray:_leftArray andRightListArray:_rightArray]; 11 |
dropdown.delegate = self; //此句的代理方法可返回选中下标值 12 |
[self.view addSubview:dropdown.view]; 13 | 14 | ### Delegate 15 | //实现代理,返回选中的下标,若左边没有列表,则返回0。ButtonIndex为打开的第几个按钮或列表下标,left为左边选中下标,right为右边选中下标 16 | - (void)dropdownSelectedButtonIndex:(NSString *)index LeftIndex:(NSString *)left RightIndex:(NSString *)right { 17 | NSLog(@"%s : You choice button %@, left %@ and right %@", __FUNCTION__, index, left, right); 18 | } 19 | 20 | ### Thanks 21 | 感谢大家对我的支持,最近做了一些小更新; 22 |
2016-04-21 -- 增加返回选的第几个button(或者选中的是第几个列表);选中后button显示选中值 23 | 24 | ### Demo 25 | ![image](https://github.com/Ryan-Wong-iOS/RW_DropdownMenu/blob/master/RW_DropdownMenu/demo.gif) 26 | -------------------------------------------------------------------------------- /RW_DropdownMenuTests/RW_DropdownMenuTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // RW_DropdownMenuTests.m 3 | // RW_DropdownMenuTests 4 | // 5 | // Created by Ryan Wong on 15/9/14. 6 | // Copyright (c) 2015年 RyanWong. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface RW_DropdownMenuTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation RW_DropdownMenuTests 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 | -------------------------------------------------------------------------------- /RW_DropdownMenu/DropdownMenu.h: -------------------------------------------------------------------------------- 1 | // 2 | // DropdownMenu.h 3 | // Common 4 | // 5 | // Created by Ryan Wong on 15/9/9. 6 | // Copyright (c) 2015年 tenfoldtech. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "DropdownButton.h" 11 | #import "ConditionDoubleTableView.h" 12 | 13 | @protocol dropdownDelegate 14 | 15 | @optional 16 | - (void)dropdownSelectedButtonIndex:(NSString *)index LeftIndex:(NSString *)left RightIndex:(NSString *)right; 17 | 18 | @end 19 | 20 | @interface DropdownMenu : UIViewController { 21 | DropdownButton *_button; 22 | ConditionDoubleTableView *_tableView; 23 | NSInteger _lastIndex; 24 | 25 | NSInteger _buttonSelectedIndex; 26 | NSMutableArray *_buttonIndexArray; 27 | 28 | NSArray *_titles; 29 | NSArray *_leftArray; 30 | NSArray *_rightArray; 31 | } 32 | 33 | @property (assign, nonatomic) iddelegate; 34 | 35 | - (id)initDropdownWithButtonTitles:(NSArray*)titles andLeftListArray:(NSArray*)leftArray andRightListArray:(NSArray *)rightArray; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /RW_DropdownMenu/ConditionDoubleTableView.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConditionDoubleTableView.h 3 | // MacauFood 4 | // 5 | // Created by Ryan Wong on 15/8/21. 6 | // Copyright (c) 2015年 tenfoldtech. All rights reserved. 7 | // 8 | 9 | #import 10 | @protocol ConditionDoubleTableViewDelegate 11 | 12 | @required 13 | - (void)selectedFirstValue:(NSString *)first SecondValue:(NSString *)second; 14 | - (void)hideMenu; 15 | @end 16 | 17 | @interface ConditionDoubleTableView : UIViewController { 18 | UIView *_rootView; 19 | 20 | UITableView *_firstTableView; 21 | UITableView *_secondTableView; 22 | 23 | NSArray *_leftItems; 24 | NSArray *_rightItems; 25 | NSArray *_leftArray; 26 | NSArray *_rightArray; 27 | 28 | NSInteger firstSelectedIndex; 29 | NSInteger secondSelectedIndex; 30 | 31 | NSInteger _buttonIndex; 32 | 33 | BOOL isHidden; 34 | } 35 | 36 | @property (nonatomic, strong) id delegate; 37 | 38 | //初始化下拉菜单 39 | - (id)initWithFrame:(CGRect)frame andLeftItems:(NSArray *)leftItems andRightItems:(NSArray *)RightItems; 40 | //显示下拉菜单 41 | - (void)showTableView:(NSInteger)index WithSelectedLeft:(NSString *)left Right:(NSString *)right; 42 | - (void)hideTableView; 43 | @end 44 | -------------------------------------------------------------------------------- /RW_DropdownMenu/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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /RW_DropdownMenu/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 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 | -------------------------------------------------------------------------------- /RW_DropdownMenu/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.Ryan.$(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 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /RW_DropdownMenu/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // RW_DropdownMenu 4 | // 5 | // Created by Ryan Wong on 15/9/14. 6 | // Copyright (c) 2015年 RyanWong. 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 | 20 | self.viewController = [[ViewController alloc] init]; 21 | self.viewController.view.backgroundColor = [UIColor whiteColor]; 22 | self.nav = [[UINavigationController alloc] initWithRootViewController:_viewController]; 23 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 24 | [self.window setRootViewController:_nav]; 25 | [self.window makeKeyAndVisible]; 26 | 27 | return YES; 28 | } 29 | 30 | - (void)applicationWillResignActive:(UIApplication *)application { 31 | // 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. 32 | // 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. 33 | } 34 | 35 | - (void)applicationDidEnterBackground:(UIApplication *)application { 36 | // 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. 37 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 38 | } 39 | 40 | - (void)applicationWillEnterForeground:(UIApplication *)application { 41 | // 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. 42 | } 43 | 44 | - (void)applicationDidBecomeActive:(UIApplication *)application { 45 | // 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. 46 | } 47 | 48 | - (void)applicationWillTerminate:(UIApplication *)application { 49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /RW_DropdownMenu/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // RW_DropdownMenu 4 | // 5 | // Created by Ryan Wong on 15/9/14. 6 | // Copyright (c) 2015年 RyanWong. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "TestDropdownViewController.h" 11 | 12 | #define SCREEN_RECT ([UIScreen mainScreen].bounds) 13 | 14 | @interface ViewController () { 15 | UITableView *_tableView; 16 | 17 | NSArray *_array; 18 | } 19 | 20 | @end 21 | 22 | @implementation ViewController 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | // Do any additional setup after loading the view, typically from a nib. 27 | self.title = @"测试列表"; 28 | _tableView = [[UITableView alloc] initWithFrame:SCREEN_RECT style:UITableViewStylePlain]; 29 | _tableView.delegate = self; 30 | _tableView.dataSource = self; 31 | _array = @[@"下拉菜单"]; 32 | [self.view addSubview:_tableView]; 33 | } 34 | 35 | 36 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 37 | return 44.0; 38 | } 39 | 40 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 41 | return _array.count; 42 | } 43 | 44 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 45 | UITableViewCell *cell = nil; 46 | switch (indexPath.section) { 47 | case 0: 48 | { 49 | cell = [tableView dequeueReusableCellWithIdentifier:@"testCell"]; 50 | 51 | if (cell == nil) { 52 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"testCell"]; 53 | } 54 | [self removeCellView:cell]; 55 | UILabel *titleLab = [[UILabel alloc] initWithFrame:CGRectMake(15, 0, 100, 44)]; 56 | titleLab.text = [_array objectAtIndex:indexPath.row]; 57 | [cell.contentView addSubview:titleLab]; 58 | break; 59 | } 60 | default: 61 | break; 62 | } 63 | cell.selectionStyle = UITableViewCellSelectionStyleDefault; 64 | return cell; 65 | } 66 | 67 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 68 | if (indexPath.row == 0) { 69 | TestDropdownViewController *dropDown = [[TestDropdownViewController alloc] initWithFrame:SCREEN_RECT]; 70 | [self.navigationController pushViewController:dropDown animated:YES]; 71 | } 72 | } 73 | 74 | - (void)removeCellView:(UITableViewCell*)cell { 75 | NSArray *subviews = [[NSArray alloc] initWithArray:cell.contentView.subviews]; 76 | for (UIView *subview in subviews) { 77 | [subview removeFromSuperview]; 78 | } 79 | } 80 | 81 | 82 | - (void)didReceiveMemoryWarning { 83 | [super didReceiveMemoryWarning]; 84 | // Dispose of any resources that can be recreated. 85 | } 86 | 87 | @end 88 | -------------------------------------------------------------------------------- /RW_DropdownMenu/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 | -------------------------------------------------------------------------------- /RW_DropdownMenu/DropdownButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // DropdownButton.m 3 | // Common 4 | // 5 | // Created by Ryan Wong on 15/9/9. 6 | // Copyright (c) 2015年 tenfoldtech. All rights reserved. 7 | // 8 | 9 | #import "DropdownButton.h" 10 | #import "CommonDefine.h" 11 | 12 | #define BUTTON_HEIGHT 40.0 13 | 14 | @implementation DropdownButton 15 | 16 | - (id)initDropdownButtonWithTitles:(NSArray*)titles{ 17 | self = [super initWithFrame:CGRectMake(0, STATUS_AND_NAVIGATION_HEIGHT, SCREEN_WIDTH, BUTTON_HEIGHT)]; 18 | if (self) { 19 | _isButtion = NO; 20 | _count = titles.count; 21 | [self addButtonToView:titles]; 22 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideMenu:) name:@"hideMenu" object:_lastTapObj]; 23 | } 24 | return self; 25 | } 26 | 27 | - (void)addButtonToView:(NSArray *)titles { 28 | for (int i = 0; i < _count; i++) { 29 | UIButton *button = [self makeButton:[titles objectAtIndex:i] andIndex:i]; 30 | [self addSubview:button]; 31 | if (i > 0) { 32 | UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(button.frame.origin.x, 10, 1, 20)]; 33 | lineView.backgroundColor = [UIColor colorWithRed:(217.0 / 255.0) green:(217.0 / 255.0) blue:(217.0 / 255.0) alpha:1.0f]; 34 | [self addSubview:lineView]; 35 | } 36 | } 37 | UIView *bottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, BUTTON_HEIGHT, SCREEN_WIDTH, 1)]; 38 | bottomLine.backgroundColor = [UIColor colorWithRed:(217.0 / 255.0) green:(217.0 / 255.0) blue:(217.0 / 255.0) alpha:1.0f]; 39 | [self addSubview:bottomLine]; 40 | } 41 | 42 | - (UIButton *)makeButton:(NSString *) title andIndex:(int)index{ 43 | float width = [self returnTitlesWidth]; 44 | float offsetX = width * index; 45 | _image = [UIImage imageNamed:@"expandableImage"]; 46 | float padding = (width - (_image.size.width + [title sizeWithFont:[UIFont systemFontOfSize:13.0f]].width)) / 2; 47 | UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(offsetX, 0, width, BUTTON_HEIGHT)]; 48 | button.tag = 10000 + index; 49 | [button setImage:_image forState:UIControlStateNormal]; 50 | [button setImageEdgeInsets:UIEdgeInsetsMake(11, [title sizeWithFont:[UIFont systemFontOfSize:13.0f]].width + padding + 5, 11, 0)]; 51 | [button.titleLabel setFont:[UIFont systemFontOfSize:13.0f]]; 52 | [button setTitle:title forState:UIControlStateNormal]; 53 | [button setTitleEdgeInsets:UIEdgeInsetsMake(11, 0, 11, _image.size.width + 5)]; 54 | [button setBackgroundColor:[UIColor whiteColor]]; 55 | [button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 56 | [button addTarget:self action:@selector(showMenuAction:) forControlEvents:UIControlEventTouchUpInside]; 57 | return button; 58 | } 59 | 60 | - (float)returnTitlesWidth { 61 | float width = SCREEN_WIDTH / _count; 62 | return width; 63 | } 64 | 65 | - (void)showMenuAction:(id)sender { 66 | NSInteger i = [sender tag]; 67 | [self openMenuBtnAnimation:i]; 68 | } 69 | 70 | - (void)openMenuBtnAnimation:(NSInteger)index{ 71 | if (_lastTap != index) { 72 | if (_lastTap > 0) { 73 | [self changeButtionTag:_lastTap Rotation:0]; 74 | } 75 | _lastTap = index; 76 | [self changeButtionTag:index Rotation:M_PI]; 77 | [self.delegate showMenu:index]; 78 | } else { 79 | _isButtion = YES; 80 | [self changeButtionTag:_lastTap Rotation:0]; 81 | _lastTap = 0; 82 | [self.delegate hideMenu]; 83 | } 84 | } 85 | 86 | - (void)hideMenu:(NSNotification *)notification { 87 | _lastTapObj = [notification object]; 88 | if (_isButtion != YES) { 89 | [self changeButtionTag:([_lastTapObj intValue] + 10000) Rotation:0]; 90 | _isButtion = NO; 91 | } 92 | _lastTap = 0; 93 | } 94 | 95 | - (void)changeButtionTag:(NSInteger)index Rotation:(CGFloat)angle { 96 | [UIView animateWithDuration:0.1f animations:^{ 97 | UIButton *btn = (UIButton *)[self viewWithTag:index]; 98 | if (angle == 0) { 99 | [btn setBackgroundColor:[UIColor whiteColor]]; 100 | } else { 101 | [btn setBackgroundColor:[UIColor colorWithRed:(221.0/255.0) green:(221.0/255.0) blue:(221.0/255.0) alpha:1.0f]]; 102 | } 103 | btn.imageView.transform = CGAffineTransformMakeRotation(angle); 104 | }]; 105 | } 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /RW_DropdownMenu/DropdownMenu.m: -------------------------------------------------------------------------------- 1 | // 2 | // DropdownMenu.m 3 | // Common 4 | // 5 | // Created by Ryan Wong on 15/9/9. 6 | // Copyright (c) 2015年 tenfoldtech. All rights reserved. 7 | // 8 | 9 | #import "DropdownMenu.h" 10 | #import "CommonDefine.h" 11 | 12 | @implementation DropdownMenu 13 | 14 | - (id)initDropdownWithButtonTitles:(NSArray*)titles andLeftListArray:(NSArray*)leftArray andRightListArray:(NSArray *)rightArray { 15 | self = [super init]; 16 | if (self) { 17 | self.view.frame = CGRectMake(0, 0, SCREEN_WIDTH, 104); 18 | _button = [[DropdownButton alloc] initDropdownButtonWithTitles:titles]; 19 | _button.delegate = self; 20 | _tableView = [[ConditionDoubleTableView alloc] initWithFrame:self.view.bounds andLeftItems:leftArray andRightItems:rightArray]; 21 | _tableView.delegate = self; 22 | _titles = titles; 23 | _leftArray = leftArray; 24 | _rightArray = rightArray; 25 | [self.view addSubview:_tableView.view]; 26 | [self.view addSubview:_button]; 27 | [self initSelectedArray:titles]; 28 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reduceBackgroundSize) name:@"hideMenu" object:nil]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)initSelectedArray:(NSArray *)titles { 34 | _buttonIndexArray = [[NSMutableArray alloc] initWithCapacity:titles.count]; 35 | } 36 | 37 | //button点击代理 38 | - (void)showMenu:(NSInteger)index { 39 | _lastIndex = index; 40 | [self.view setFrame:SCREEN_RECT]; 41 | _buttonSelectedIndex = index - 10000; 42 | NSString *selected = @"0-0"; 43 | if (_buttonIndexArray.count > _buttonSelectedIndex){ 44 | selected = [_buttonIndexArray objectAtIndex:_buttonSelectedIndex]; 45 | } else { 46 | for (int i = 0; i < _buttonSelectedIndex; i++) { 47 | 48 | [_buttonIndexArray addObject:selected]; 49 | } 50 | } 51 | NSArray *selectedArray = [selected componentsSeparatedByString:@"-"]; 52 | NSString *left = [selectedArray objectAtIndex:0]; 53 | NSString *right = [selectedArray objectAtIndex:1]; 54 | [_tableView showTableView:_buttonSelectedIndex WithSelectedLeft:left Right:right]; 55 | } 56 | 57 | - (void)hideMenu { 58 | [_tableView hideTableView]; 59 | } 60 | 61 | - (void)reduceBackgroundSize { 62 | [self.view setFrame:CGRectMake(0, 0, SCREEN_WIDTH, 104)]; 63 | } 64 | 65 | - (void)selectedFirstValue:(NSString *)first SecondValue:(NSString *)second{ 66 | NSString *index = [NSString stringWithFormat:@"%@-%@", first, second]; 67 | [_buttonIndexArray setObject:index atIndexedSubscript:_buttonSelectedIndex]; 68 | [self returnSelectedLeftIndex:first RightIndex:second]; 69 | } 70 | 71 | - (void)returnSelectedLeftIndex:(NSString *)left RightIndex:(NSString *)right { 72 | 73 | NSString *buttonIndex = [NSString stringWithFormat:@"%ld",(long)_lastIndex - 10000]; 74 | NSDictionary *dic = [self returnSelectedValueWithIndex:buttonIndex Left:left Right:right]; 75 | NSString *title = [dic objectForKey:@"title"]; 76 | NSString *leftValue = [dic objectForKey:@"left"]; 77 | NSString *rightValue = [dic objectForKey:@"right"]; 78 | if(rightValue.length>5){ 79 | rightValue=[NSString stringWithFormat:@"%@...",[rightValue substringToIndex:4]]; 80 | } 81 | [self changeButtonTitle:rightValue]; 82 | //业务需要返回下标,删除可返回选中值 83 | title = buttonIndex; 84 | leftValue = left; 85 | rightValue = right; 86 | SEL aSelector = @selector(dropdownSelectedButtonIndex:LeftIndex:RightIndex:); 87 | if([_delegate respondsToSelector:aSelector]) { 88 | NSInvocation *inv = [NSInvocation invocationWithMethodSignature:[[_delegate class] instanceMethodSignatureForSelector:aSelector]]; 89 | [inv setSelector:aSelector]; 90 | [inv setTarget:_delegate]; 91 | [inv setArgument:&title atIndex:2]; //arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation 92 | [inv setArgument:&left atIndex:3]; //arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation 93 | [inv setArgument:&right atIndex:4]; 94 | [inv invoke]; 95 | } 96 | } 97 | 98 | - (NSDictionary *)returnSelectedValueWithIndex:(NSString *)index Left:(NSString *)left Right:(NSString *)right { 99 | NSString *title = [_titles objectAtIndex:[index intValue]]; 100 | NSArray *leftArray = [_leftArray objectAtIndex:[index intValue]]; 101 | NSString *leftValue = @"null"; 102 | if (leftArray.count > 0) { 103 | leftValue = [leftArray objectAtIndex:[left intValue]]; 104 | } 105 | NSArray *rightArray = [_rightArray objectAtIndex:[index intValue]]; 106 | NSArray *rightValueArray= [rightArray objectAtIndex:[left intValue]]; 107 | NSString *rightValue = [[rightValueArray objectAtIndex:[right intValue]] valueForKey:@"title"]; 108 | NSDictionary *dic = [[NSDictionary alloc] initWithObjectsAndKeys:title, @"title", leftValue, @"left", rightValue, @"right", nil]; 109 | return dic; 110 | } 111 | 112 | - (void)changeButtonTitle:(NSString *)menu{ 113 | UIButton *button = (UIButton *)[_button viewWithTag:_lastIndex]; 114 | [button setTitle:menu forState:UIControlStateNormal]; 115 | } 116 | 117 | @end 118 | -------------------------------------------------------------------------------- /RW_DropdownMenu/TestDropdownViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestDropdownViewController.m 3 | // Common 4 | // 5 | // Created by Ryan Wong on 15/9/11. 6 | // Copyright (c) 2015年 tenfoldtech. All rights reserved. 7 | // 8 | 9 | #import "TestDropdownViewController.h" 10 | #import "DropdownMenu.h" 11 | 12 | @interface TestDropdownViewController () { 13 | 14 | ConditionDoubleTableView *tableView; 15 | NSArray *_titleArray; 16 | NSArray *_leftArray; 17 | NSArray *_rightArray; 18 | } 19 | 20 | @end 21 | 22 | @implementation TestDropdownViewController 23 | 24 | - (id)initWithFrame:(CGRect)frame { 25 | self = [super init]; 26 | if (self) { 27 | self.view.frame = frame; 28 | self.view.backgroundColor = [UIColor whiteColor]; 29 | } 30 | return self; 31 | } 32 | 33 | - (void)viewDidLoad { 34 | [super viewDidLoad]; 35 | // Do any additional setup after loading the view. 36 | 37 | [self testData]; 38 | DropdownMenu *dropdown = [[DropdownMenu alloc] initDropdownWithButtonTitles:_titleArray andLeftListArray:_leftArray andRightListArray:_rightArray]; 39 | dropdown.delegate = self; //此句的代理方法可返回选中下标值 40 | [self.view addSubview:dropdown.view]; 41 | } 42 | 43 | //测试数据 44 | - (void)testData { 45 | [self testTitleArray]; 46 | [self testLeftArray]; 47 | [self testRightArray]; 48 | } 49 | 50 | //每个下拉的标题 51 | - (void) testTitleArray { 52 | _titleArray = @[@"附近", @"菜品",@"特殊",@"运动"]; 53 | } 54 | 55 | //左边列表可为空,则为单下拉菜单,可以根据需要传参 56 | - (void)testLeftArray { 57 | NSArray *One_leftArray = @[@"附近", @"熱門商區", @"香洲區", @"斗門區", @"金灣區"]; 58 | // NSArray *Two_leftArray = [[NSArray alloc] init]; 59 | NSArray *Two_leftArray = @[@"Test1", @"Test2"]; 60 | NSArray *Three_leftArray = @[@"洗脚",@"大保健"]; 61 | NSArray *Four_leftArray = @[@"跑步",@"健身"]; 62 | 63 | 64 | _leftArray = [[NSArray alloc] initWithObjects:One_leftArray, Two_leftArray, Three_leftArray, Four_leftArray, nil]; 65 | } 66 | 67 | //右边列表不可为空 68 | - (void)testRightArray { 69 | NSArray *F_rightArray = @[ 70 | @[ 71 | @{@"title":@"500米"}, 72 | @{@"title":@"1000米"}, 73 | @{@"title":@"2000米"}, 74 | @{@"title":@"5000米"} 75 | ] , 76 | @[ 77 | @{@"title":@"全部商區"}, 78 | @{@"title":@"拱北"}, 79 | @{@"title":@"香洲"}, 80 | @{@"title":@"吉大"}, 81 | @{@"title":@"華髮商都"}, 82 | @{@"title":@"富華里"}, 83 | @{@"title":@"揚名廣場"}, 84 | @{@"title":@"摩爾廣場"}, 85 | @{@"title":@"井岸鎮"}, 86 | @{@"title":@"紅旗鎮"}, 87 | @{@"title":@"三灶鎮"}, 88 | ], 89 | @[ 90 | @{@"title":@"全部香洲區"}, 91 | @{@"title":@"拱北"}, 92 | @{@"title":@"香洲"}, 93 | @{@"title":@"吉大"}, 94 | @{@"title":@"華髮商都"}, 95 | @{@"title":@"富華里"}, 96 | @{@"title":@"揚名廣場"}, 97 | @{@"title":@"摩爾廣場"}, 98 | ], 99 | @[ 100 | @{@"title":@"全部斗門區"}, 101 | @{@"title":@"井岸鎮"}, 102 | ], 103 | @[ 104 | @{@"title":@"全部金灣區"}, 105 | @{@"title":@"紅旗鎮"}, 106 | @{@"title":@"三灶鎮"}, 107 | ] 108 | ]; 109 | 110 | NSArray *S_rightArray = @[ 111 | @[ 112 | @{@"title":@"one"}, 113 | @{@"title":@"two"}, 114 | @{@"title":@"three"}, 115 | @{@"title":@"four"} 116 | ] , 117 | @[ 118 | @{@"title":@"four"} 119 | ] 120 | ]; 121 | NSArray *T_rightArray = @[ 122 | @[ 123 | @{@"title":@"足浴"}, 124 | @{@"title":@"脚底按摩"} 125 | ], 126 | @[ 127 | @{@"title":@"全套"}, 128 | @{@"title":@"推油"} 129 | ] 130 | ]; 131 | NSArray *Fourth_rightArray = @[ 132 | @[ 133 | @{@"title":@"接力跑"}, 134 | @{@"title":@"200米"} 135 | ], 136 | @[ 137 | @{@"title":@"有氧运动"}, 138 | @{@"title":@"无氧运动"} 139 | ] 140 | ]; 141 | 142 | _rightArray = [[NSArray alloc] initWithObjects:F_rightArray, S_rightArray, T_rightArray, Fourth_rightArray, nil]; 143 | } 144 | 145 | //实现代理,返回选中的下标,若左边没有列表,则返回0 146 | - (void)dropdownSelectedButtonIndex:(NSString *)index LeftIndex:(NSString *)left RightIndex:(NSString *)right { 147 | NSLog(@"%s : You choice button %@, left %@ and right %@", __FUNCTION__, index, left, right); 148 | } 149 | 150 | - (void)didReceiveMemoryWarning { 151 | [super didReceiveMemoryWarning]; 152 | // Dispose of any resources that can be recreated. 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /RW_DropdownMenu/ConditionDoubleTableView.m: -------------------------------------------------------------------------------- 1 | // 2 | // ConditionDoubleTableView.m 3 | // MacauFood 4 | // 5 | // Created by Ryan Wong on 15/8/21. 6 | // Copyright (c) 2015年 tenfoldtech. All rights reserved. 7 | // 8 | 9 | #import "ConditionDoubleTableView.h" 10 | #import "CommonDefine.h" 11 | 12 | #define CELLHEIGHT 44.0; 13 | 14 | @implementation ConditionDoubleTableView 15 | 16 | #pragma mark - 初始化 17 | - (id)initWithFrame:(CGRect)frame andLeftItems:(NSArray *)leftItems andRightItems:(NSArray *)RightItems{ 18 | frame = SCREEN_RECT; 19 | // self = [super initWithFrame:CGRectMake(0, STATUS_AND_NAVIGATION_HEIGHT + 40, frame.size.width, frame.size.height - STATUS_AND_NAVIGATION_HEIGHT - 40)]; 20 | self = [super init]; 21 | if (self) { 22 | self.view.frame = CGRectMake(0, STATUS_AND_NAVIGATION_HEIGHT + 40, frame.size.width, frame.size.height - STATUS_AND_NAVIGATION_HEIGHT - 40); 23 | self.view.backgroundColor = [self colorWithRGB:0x000000 alpha:0.3]; 24 | _rootView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height / 2)]; 25 | UIView *bottomView = [[UIView alloc] initWithFrame:CGRectMake(0, frame.size.height / 2, frame.size.width, frame.size.height / 2 - STATUS_AND_NAVIGATION_HEIGHT - 40)]; 26 | UITapGestureRecognizer *tapDimissMenu = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideTableView)]; 27 | [bottomView addGestureRecognizer:tapDimissMenu]; 28 | 29 | _buttonIndex = -1; 30 | isHidden = YES; 31 | _leftItems = leftItems; 32 | _rightItems = RightItems; 33 | 34 | [self initFirstTableViewWithFrame:frame]; 35 | [self initSecondTableViewWithFrame:frame]; 36 | [self.view addSubview:_rootView]; 37 | [self.view addSubview:bottomView]; 38 | } 39 | [self.view setHidden:YES]; 40 | return self; 41 | } 42 | 43 | - (void)initFirstTableViewWithFrame:(CGRect)frame { 44 | _firstTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width / 2, frame.size.height / 2) style:UITableViewStylePlain]; 45 | _firstTableView.separatorStyle = UITableViewCellSelectionStyleNone; 46 | _firstTableView.backgroundColor = [self colorWithRGB:0xFAFAFA]; 47 | _firstTableView.delegate = self; 48 | _firstTableView.dataSource = self; 49 | [_rootView addSubview:_firstTableView]; 50 | // [_firstTableView reloadData]; 51 | } 52 | 53 | - (void)initSecondTableViewWithFrame:(CGRect)frame { 54 | _secondTableView = [[UITableView alloc] initWithFrame:CGRectMake(frame.size.width / 2, 0, frame.size.width, frame.size.height / 2) style:UITableViewStylePlain]; 55 | _secondTableView.separatorStyle = UITableViewCellSelectionStyleNone; 56 | _secondTableView.backgroundColor = [UIColor whiteColor]; 57 | _secondTableView.delegate = self; 58 | _secondTableView.dataSource = self; 59 | [_rootView addSubview:_secondTableView]; 60 | } 61 | 62 | #pragma mark - tableView代理 63 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 64 | if (tableView == _firstTableView) { 65 | return _leftArray.count; 66 | } else if (tableView == _secondTableView) { 67 | if (_rightArray.count > firstSelectedIndex) { 68 | NSArray *array = [_rightArray objectAtIndex:firstSelectedIndex]; 69 | return array.count; 70 | } else { 71 | return 0; 72 | } 73 | } 74 | return 0; 75 | } 76 | 77 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 78 | 79 | UITableViewCell *cell = nil; 80 | if (tableView == _firstTableView) { 81 | switch (indexPath.section) { 82 | case 0: 83 | { 84 | cell = [tableView dequeueReusableCellWithIdentifier:@"FirstCell"]; 85 | if (cell == nil) { 86 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"FirstCell"]; 87 | } 88 | [self removeCellView:cell]; 89 | if (_leftArray.count > 0) { 90 | cell.textLabel.text = [_leftArray objectAtIndex:indexPath.row]; 91 | } 92 | break; 93 | } 94 | default: 95 | break; 96 | } 97 | 98 | UIView *selectView = [[UIView alloc] initWithFrame:cell.contentView.bounds]; 99 | selectView.backgroundColor = [UIColor whiteColor]; 100 | cell.selectedBackgroundView = selectView; 101 | cell.backgroundColor = [UIColor clearColor]; 102 | 103 | } else if (tableView == _secondTableView){ 104 | switch (indexPath.section) { 105 | case 0: 106 | { 107 | cell = [tableView dequeueReusableCellWithIdentifier:@"SecondCell"]; 108 | if (cell == nil) { 109 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SecondCell"]; 110 | } 111 | [self removeCellView:cell]; 112 | NSArray *array = [_rightArray objectAtIndex:firstSelectedIndex]; 113 | if (array.count <= 0) { 114 | break; 115 | } 116 | NSDictionary *dic = [array objectAtIndex:indexPath.row]; 117 | cell.textLabel.text = [dic valueForKey:@"title"]; 118 | cell.textLabel.highlightedTextColor = [self colorWithRGB:0x90EE90]; 119 | break; 120 | } 121 | default: 122 | break; 123 | } 124 | UIView *noSelectView = [[UIView alloc] initWithFrame:cell.contentView.bounds]; 125 | UIView *noSelectLine = [[UIView alloc] initWithFrame:CGRectMake(15, cell.contentView.bounds.size.height-1, cell.contentView.bounds.size.width - 15, 0.5)]; 126 | noSelectLine.backgroundColor = [self colorWithRGB:0xBEBEBE]; 127 | [noSelectView addSubview:noSelectLine]; 128 | UIView *selectView = [[UIView alloc] initWithFrame:cell.contentView.bounds]; 129 | UIView *selectLine = [[UIView alloc] initWithFrame:CGRectMake(15, cell.contentView.bounds.size.height-1, cell.contentView.bounds.size.width - 15, 0.5)]; 130 | selectLine.backgroundColor = [self colorWithRGB:0x90EE90]; 131 | [selectView addSubview:selectLine]; 132 | cell.backgroundView = noSelectView; 133 | cell.selectedBackgroundView = selectView; 134 | } 135 | 136 | return cell; 137 | } 138 | 139 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 140 | return CELLHEIGHT; 141 | } 142 | 143 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 144 | if (tableView == _firstTableView && _leftArray.count > 0) { 145 | firstSelectedIndex = indexPath.row; 146 | [_secondTableView reloadData]; 147 | } else { 148 | [self returnSelectedValue:indexPath.row]; 149 | } 150 | 151 | } 152 | 153 | - (void)removeCellView:(UITableViewCell*)cell { 154 | NSArray *subviews = [[NSArray alloc] initWithArray:cell.contentView.subviews]; 155 | for (UIView *subview in subviews) { 156 | [subview removeFromSuperview]; 157 | } 158 | } 159 | 160 | #pragma mark - 私有方法 161 | //显示下拉菜单 162 | - (void)showTableView:(NSInteger)index WithSelectedLeft:(NSString *)left Right:(NSString *)right { 163 | if (isHidden == YES || _buttonIndex != index) { 164 | _buttonIndex = index; 165 | isHidden = NO; 166 | self.view.alpha = 1.0; 167 | [self.view setHidden:NO]; 168 | [self reloadTableViewData:index]; 169 | [self showSingleOrDouble]; 170 | [self showLastSelectedLeft:left Right:right]; 171 | _rootView.center = CGPointMake(self.view.frame.size.width / 2, 0 - _rootView.bounds.size.height / 2); 172 | [UIView animateWithDuration:0.5 animations:^{ 173 | _rootView.center = CGPointMake(self.view.frame.size.width / 2, _rootView.bounds.size.height / 2); 174 | }]; 175 | } else { 176 | [self hideTableView]; 177 | } 178 | } 179 | 180 | - (void)showSingleOrDouble { 181 | if (_leftArray.count <= 0) { 182 | [_firstTableView setHidden:YES]; 183 | _secondTableView.frame = CGRectMake( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2); 184 | } else { 185 | [_firstTableView setHidden:NO]; 186 | _secondTableView.frame = CGRectMake(SCREEN_WIDTH / 2, 0, SCREEN_WIDTH, SCREEN_HEIGHT / 2); 187 | } 188 | } 189 | 190 | //按了不同按钮,刷新菜单数据 191 | - (void)reloadTableViewData:(NSInteger)index { 192 | _leftArray = [[NSArray alloc] initWithArray:[_leftItems objectAtIndex:index]]; 193 | _rightArray = [[NSArray alloc] initWithArray:[_rightItems objectAtIndex:index]]; 194 | } 195 | 196 | //渐渐隐藏菜单 197 | - (void)hideTableView { 198 | isHidden = YES; 199 | [UIView animateWithDuration:0.5 animations:^{ 200 | self.view.alpha = 0.0; 201 | } completion:^(BOOL finish){ 202 | [self.view setHidden:YES]; 203 | _rootView.center = CGPointMake(self.view.frame.size.width / 2, 0 - _rootView.bounds.size.height / 2); 204 | [[NSNotificationCenter defaultCenter] postNotificationName:@"hideMenu" object:[NSString stringWithFormat:@"%ld",(long)_buttonIndex]]; 205 | }]; 206 | } 207 | 208 | //返回选中位置 209 | - (void)returnSelectedValue:(NSInteger)index { 210 | if (self.delegate && [self.delegate respondsToSelector:@selector(selectedFirstValue:SecondValue:)]) { 211 | NSInteger firstSelected = firstSelectedIndex > 0 ? firstSelectedIndex : 0; 212 | NSString *firstIndex = [NSString stringWithFormat:@"%ld", firstSelected]; 213 | NSString *indexObj = [NSString stringWithFormat:@"%ld", (long)index]; 214 | [self.delegate performSelector:@selector(selectedFirstValue:SecondValue:) withObject:firstIndex withObject:indexObj]; 215 | [self hideTableView]; 216 | } 217 | } 218 | 219 | //显示最后一次选中位置 220 | - (void)showLastSelectedLeft:(NSString *)leftSelected Right:(NSString *)rightSelected { 221 | 222 | NSInteger left = [leftSelected intValue]; 223 | if (_leftArray.count > 0) { 224 | [_firstTableView reloadData]; 225 | NSIndexPath *leftSelectedIndexPath = [NSIndexPath indexPathForRow:left inSection:0]; 226 | [_firstTableView selectRowAtIndexPath:leftSelectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; 227 | } 228 | firstSelectedIndex = left; 229 | 230 | NSInteger right = [rightSelected intValue]; 231 | [_secondTableView reloadData]; 232 | NSIndexPath *rightSelectedIndexPath = [NSIndexPath indexPathForRow:right inSection:0]; 233 | [_secondTableView selectRowAtIndexPath:rightSelectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; 234 | } 235 | 236 | - (UIColor*)colorWithRGB:(unsigned int)RGBValue 237 | { 238 | return [UIColor colorWithRed:((RGBValue&0xFF0000)>>16)/255.0 green:((RGBValue&0xFF00)>>8)/255.0 blue:(RGBValue&0xFF)/255.0 alpha:1]; 239 | } 240 | 241 | - (UIColor*)colorWithRGB:(unsigned int)RGBValue alpha:(CGFloat)alpha 242 | { 243 | return [UIColor colorWithRed:((RGBValue&0xFF0000)>>16)/255.0 green:((RGBValue&0xFF00)>>8)/255.0 blue:(RGBValue&0xFF)/255.0 alpha:alpha]; 244 | } 245 | 246 | - (void)viewDidDisappear:(BOOL)animated { 247 | [[NSNotificationCenter defaultCenter] removeObserver:self name:@"hideMenu" object:nil]; 248 | } 249 | 250 | @end 251 | -------------------------------------------------------------------------------- /RW_DropdownMenu.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 9A6CE5E21BA6F15D009317D2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6CE5E11BA6F15D009317D2 /* main.m */; }; 11 | 9A6CE5E51BA6F15D009317D2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6CE5E41BA6F15D009317D2 /* AppDelegate.m */; }; 12 | 9A6CE5E81BA6F15D009317D2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6CE5E71BA6F15D009317D2 /* ViewController.m */; }; 13 | 9A6CE5EB1BA6F15D009317D2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A6CE5E91BA6F15D009317D2 /* Main.storyboard */; }; 14 | 9A6CE5ED1BA6F15D009317D2 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9A6CE5EC1BA6F15D009317D2 /* Images.xcassets */; }; 15 | 9A6CE5F01BA6F15D009317D2 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 9A6CE5EE1BA6F15D009317D2 /* LaunchScreen.xib */; }; 16 | 9A6CE5FC1BA6F15D009317D2 /* RW_DropdownMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6CE5FB1BA6F15D009317D2 /* RW_DropdownMenuTests.m */; }; 17 | 9A6CE6081BA6F172009317D2 /* TestDropdownViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6CE6071BA6F172009317D2 /* TestDropdownViewController.m */; }; 18 | 9A6CE6111BA6F236009317D2 /* ConditionDoubleTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6CE60B1BA6F236009317D2 /* ConditionDoubleTableView.m */; }; 19 | 9A6CE6121BA6F236009317D2 /* DropdownButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6CE60D1BA6F236009317D2 /* DropdownButton.m */; }; 20 | 9A6CE6131BA6F236009317D2 /* DropdownMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 9A6CE60F1BA6F236009317D2 /* DropdownMenu.m */; }; 21 | 9A6CE6141BA6F236009317D2 /* expandableImage@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9A6CE6101BA6F236009317D2 /* expandableImage@2x.png */; }; 22 | 9A6CE6171BA7068B009317D2 /* demo.gif in Resources */ = {isa = PBXBuildFile; fileRef = 9A6CE6161BA7068B009317D2 /* demo.gif */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | 9A6CE5F61BA6F15D009317D2 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = 9A6CE5D41BA6F15D009317D2 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = 9A6CE5DB1BA6F15D009317D2; 31 | remoteInfo = RW_DropdownMenu; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | 9A6CE5DC1BA6F15D009317D2 /* RW_DropdownMenu.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RW_DropdownMenu.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | 9A6CE5E01BA6F15D009317D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | 9A6CE5E11BA6F15D009317D2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 39 | 9A6CE5E31BA6F15D009317D2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 40 | 9A6CE5E41BA6F15D009317D2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 41 | 9A6CE5E61BA6F15D009317D2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 42 | 9A6CE5E71BA6F15D009317D2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 43 | 9A6CE5EA1BA6F15D009317D2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 44 | 9A6CE5EC1BA6F15D009317D2 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 45 | 9A6CE5EF1BA6F15D009317D2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 46 | 9A6CE5F51BA6F15D009317D2 /* RW_DropdownMenuTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RW_DropdownMenuTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 9A6CE5FA1BA6F15D009317D2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 9A6CE5FB1BA6F15D009317D2 /* RW_DropdownMenuTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RW_DropdownMenuTests.m; sourceTree = ""; }; 49 | 9A6CE6061BA6F172009317D2 /* TestDropdownViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestDropdownViewController.h; sourceTree = ""; }; 50 | 9A6CE6071BA6F172009317D2 /* TestDropdownViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestDropdownViewController.m; sourceTree = ""; }; 51 | 9A6CE60A1BA6F236009317D2 /* ConditionDoubleTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConditionDoubleTableView.h; sourceTree = ""; }; 52 | 9A6CE60B1BA6F236009317D2 /* ConditionDoubleTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConditionDoubleTableView.m; sourceTree = ""; }; 53 | 9A6CE60C1BA6F236009317D2 /* DropdownButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DropdownButton.h; sourceTree = ""; }; 54 | 9A6CE60D1BA6F236009317D2 /* DropdownButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DropdownButton.m; sourceTree = ""; }; 55 | 9A6CE60E1BA6F236009317D2 /* DropdownMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DropdownMenu.h; sourceTree = ""; }; 56 | 9A6CE60F1BA6F236009317D2 /* DropdownMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DropdownMenu.m; sourceTree = ""; }; 57 | 9A6CE6101BA6F236009317D2 /* expandableImage@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "expandableImage@2x.png"; sourceTree = ""; }; 58 | 9A6CE6151BA6F395009317D2 /* CommonDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CommonDefine.h; sourceTree = ""; }; 59 | 9A6CE6161BA7068B009317D2 /* demo.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = demo.gif; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 9A6CE5D91BA6F15D009317D2 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | 9A6CE5F21BA6F15D009317D2 /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | /* End PBXFrameworksBuildPhase section */ 78 | 79 | /* Begin PBXGroup section */ 80 | 9A6CE5D31BA6F15D009317D2 = { 81 | isa = PBXGroup; 82 | children = ( 83 | 9A6CE5DE1BA6F15D009317D2 /* RW_DropdownMenu */, 84 | 9A6CE5F81BA6F15D009317D2 /* RW_DropdownMenuTests */, 85 | 9A6CE5DD1BA6F15D009317D2 /* Products */, 86 | ); 87 | sourceTree = ""; 88 | }; 89 | 9A6CE5DD1BA6F15D009317D2 /* Products */ = { 90 | isa = PBXGroup; 91 | children = ( 92 | 9A6CE5DC1BA6F15D009317D2 /* RW_DropdownMenu.app */, 93 | 9A6CE5F51BA6F15D009317D2 /* RW_DropdownMenuTests.xctest */, 94 | ); 95 | name = Products; 96 | sourceTree = ""; 97 | }; 98 | 9A6CE5DE1BA6F15D009317D2 /* RW_DropdownMenu */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 9A6CE6161BA7068B009317D2 /* demo.gif */, 102 | 9A6CE6091BA6F22B009317D2 /* DropdownMenu */, 103 | 9A6CE6051BA6F167009317D2 /* Demo */, 104 | 9A6CE5E31BA6F15D009317D2 /* AppDelegate.h */, 105 | 9A6CE5E41BA6F15D009317D2 /* AppDelegate.m */, 106 | 9A6CE5E61BA6F15D009317D2 /* ViewController.h */, 107 | 9A6CE5E71BA6F15D009317D2 /* ViewController.m */, 108 | 9A6CE5E91BA6F15D009317D2 /* Main.storyboard */, 109 | 9A6CE5EC1BA6F15D009317D2 /* Images.xcassets */, 110 | 9A6CE5EE1BA6F15D009317D2 /* LaunchScreen.xib */, 111 | 9A6CE5DF1BA6F15D009317D2 /* Supporting Files */, 112 | ); 113 | path = RW_DropdownMenu; 114 | sourceTree = ""; 115 | }; 116 | 9A6CE5DF1BA6F15D009317D2 /* Supporting Files */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 9A6CE5E01BA6F15D009317D2 /* Info.plist */, 120 | 9A6CE5E11BA6F15D009317D2 /* main.m */, 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | 9A6CE5F81BA6F15D009317D2 /* RW_DropdownMenuTests */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 9A6CE5FB1BA6F15D009317D2 /* RW_DropdownMenuTests.m */, 129 | 9A6CE5F91BA6F15D009317D2 /* Supporting Files */, 130 | ); 131 | path = RW_DropdownMenuTests; 132 | sourceTree = ""; 133 | }; 134 | 9A6CE5F91BA6F15D009317D2 /* Supporting Files */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 9A6CE5FA1BA6F15D009317D2 /* Info.plist */, 138 | ); 139 | name = "Supporting Files"; 140 | sourceTree = ""; 141 | }; 142 | 9A6CE6051BA6F167009317D2 /* Demo */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 9A6CE6061BA6F172009317D2 /* TestDropdownViewController.h */, 146 | 9A6CE6071BA6F172009317D2 /* TestDropdownViewController.m */, 147 | ); 148 | name = Demo; 149 | sourceTree = ""; 150 | }; 151 | 9A6CE6091BA6F22B009317D2 /* DropdownMenu */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | 9A6CE6151BA6F395009317D2 /* CommonDefine.h */, 155 | 9A6CE60A1BA6F236009317D2 /* ConditionDoubleTableView.h */, 156 | 9A6CE60B1BA6F236009317D2 /* ConditionDoubleTableView.m */, 157 | 9A6CE60C1BA6F236009317D2 /* DropdownButton.h */, 158 | 9A6CE60D1BA6F236009317D2 /* DropdownButton.m */, 159 | 9A6CE60E1BA6F236009317D2 /* DropdownMenu.h */, 160 | 9A6CE60F1BA6F236009317D2 /* DropdownMenu.m */, 161 | 9A6CE6101BA6F236009317D2 /* expandableImage@2x.png */, 162 | ); 163 | name = DropdownMenu; 164 | sourceTree = ""; 165 | }; 166 | /* End PBXGroup section */ 167 | 168 | /* Begin PBXNativeTarget section */ 169 | 9A6CE5DB1BA6F15D009317D2 /* RW_DropdownMenu */ = { 170 | isa = PBXNativeTarget; 171 | buildConfigurationList = 9A6CE5FF1BA6F15D009317D2 /* Build configuration list for PBXNativeTarget "RW_DropdownMenu" */; 172 | buildPhases = ( 173 | 9A6CE5D81BA6F15D009317D2 /* Sources */, 174 | 9A6CE5D91BA6F15D009317D2 /* Frameworks */, 175 | 9A6CE5DA1BA6F15D009317D2 /* Resources */, 176 | ); 177 | buildRules = ( 178 | ); 179 | dependencies = ( 180 | ); 181 | name = RW_DropdownMenu; 182 | productName = RW_DropdownMenu; 183 | productReference = 9A6CE5DC1BA6F15D009317D2 /* RW_DropdownMenu.app */; 184 | productType = "com.apple.product-type.application"; 185 | }; 186 | 9A6CE5F41BA6F15D009317D2 /* RW_DropdownMenuTests */ = { 187 | isa = PBXNativeTarget; 188 | buildConfigurationList = 9A6CE6021BA6F15D009317D2 /* Build configuration list for PBXNativeTarget "RW_DropdownMenuTests" */; 189 | buildPhases = ( 190 | 9A6CE5F11BA6F15D009317D2 /* Sources */, 191 | 9A6CE5F21BA6F15D009317D2 /* Frameworks */, 192 | 9A6CE5F31BA6F15D009317D2 /* Resources */, 193 | ); 194 | buildRules = ( 195 | ); 196 | dependencies = ( 197 | 9A6CE5F71BA6F15D009317D2 /* PBXTargetDependency */, 198 | ); 199 | name = RW_DropdownMenuTests; 200 | productName = RW_DropdownMenuTests; 201 | productReference = 9A6CE5F51BA6F15D009317D2 /* RW_DropdownMenuTests.xctest */; 202 | productType = "com.apple.product-type.bundle.unit-test"; 203 | }; 204 | /* End PBXNativeTarget section */ 205 | 206 | /* Begin PBXProject section */ 207 | 9A6CE5D41BA6F15D009317D2 /* Project object */ = { 208 | isa = PBXProject; 209 | attributes = { 210 | LastUpgradeCheck = 0640; 211 | ORGANIZATIONNAME = RyanWong; 212 | TargetAttributes = { 213 | 9A6CE5DB1BA6F15D009317D2 = { 214 | CreatedOnToolsVersion = 6.4; 215 | }; 216 | 9A6CE5F41BA6F15D009317D2 = { 217 | CreatedOnToolsVersion = 6.4; 218 | TestTargetID = 9A6CE5DB1BA6F15D009317D2; 219 | }; 220 | }; 221 | }; 222 | buildConfigurationList = 9A6CE5D71BA6F15D009317D2 /* Build configuration list for PBXProject "RW_DropdownMenu" */; 223 | compatibilityVersion = "Xcode 3.2"; 224 | developmentRegion = English; 225 | hasScannedForEncodings = 0; 226 | knownRegions = ( 227 | en, 228 | Base, 229 | ); 230 | mainGroup = 9A6CE5D31BA6F15D009317D2; 231 | productRefGroup = 9A6CE5DD1BA6F15D009317D2 /* Products */; 232 | projectDirPath = ""; 233 | projectRoot = ""; 234 | targets = ( 235 | 9A6CE5DB1BA6F15D009317D2 /* RW_DropdownMenu */, 236 | 9A6CE5F41BA6F15D009317D2 /* RW_DropdownMenuTests */, 237 | ); 238 | }; 239 | /* End PBXProject section */ 240 | 241 | /* Begin PBXResourcesBuildPhase section */ 242 | 9A6CE5DA1BA6F15D009317D2 /* Resources */ = { 243 | isa = PBXResourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 9A6CE5EB1BA6F15D009317D2 /* Main.storyboard in Resources */, 247 | 9A6CE5F01BA6F15D009317D2 /* LaunchScreen.xib in Resources */, 248 | 9A6CE6171BA7068B009317D2 /* demo.gif in Resources */, 249 | 9A6CE6141BA6F236009317D2 /* expandableImage@2x.png in Resources */, 250 | 9A6CE5ED1BA6F15D009317D2 /* Images.xcassets in Resources */, 251 | ); 252 | runOnlyForDeploymentPostprocessing = 0; 253 | }; 254 | 9A6CE5F31BA6F15D009317D2 /* Resources */ = { 255 | isa = PBXResourcesBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | runOnlyForDeploymentPostprocessing = 0; 260 | }; 261 | /* End PBXResourcesBuildPhase section */ 262 | 263 | /* Begin PBXSourcesBuildPhase section */ 264 | 9A6CE5D81BA6F15D009317D2 /* Sources */ = { 265 | isa = PBXSourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | 9A6CE6131BA6F236009317D2 /* DropdownMenu.m in Sources */, 269 | 9A6CE6111BA6F236009317D2 /* ConditionDoubleTableView.m in Sources */, 270 | 9A6CE5E81BA6F15D009317D2 /* ViewController.m in Sources */, 271 | 9A6CE6121BA6F236009317D2 /* DropdownButton.m in Sources */, 272 | 9A6CE5E51BA6F15D009317D2 /* AppDelegate.m in Sources */, 273 | 9A6CE5E21BA6F15D009317D2 /* main.m in Sources */, 274 | 9A6CE6081BA6F172009317D2 /* TestDropdownViewController.m in Sources */, 275 | ); 276 | runOnlyForDeploymentPostprocessing = 0; 277 | }; 278 | 9A6CE5F11BA6F15D009317D2 /* Sources */ = { 279 | isa = PBXSourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 9A6CE5FC1BA6F15D009317D2 /* RW_DropdownMenuTests.m in Sources */, 283 | ); 284 | runOnlyForDeploymentPostprocessing = 0; 285 | }; 286 | /* End PBXSourcesBuildPhase section */ 287 | 288 | /* Begin PBXTargetDependency section */ 289 | 9A6CE5F71BA6F15D009317D2 /* PBXTargetDependency */ = { 290 | isa = PBXTargetDependency; 291 | target = 9A6CE5DB1BA6F15D009317D2 /* RW_DropdownMenu */; 292 | targetProxy = 9A6CE5F61BA6F15D009317D2 /* PBXContainerItemProxy */; 293 | }; 294 | /* End PBXTargetDependency section */ 295 | 296 | /* Begin PBXVariantGroup section */ 297 | 9A6CE5E91BA6F15D009317D2 /* Main.storyboard */ = { 298 | isa = PBXVariantGroup; 299 | children = ( 300 | 9A6CE5EA1BA6F15D009317D2 /* Base */, 301 | ); 302 | name = Main.storyboard; 303 | sourceTree = ""; 304 | }; 305 | 9A6CE5EE1BA6F15D009317D2 /* LaunchScreen.xib */ = { 306 | isa = PBXVariantGroup; 307 | children = ( 308 | 9A6CE5EF1BA6F15D009317D2 /* Base */, 309 | ); 310 | name = LaunchScreen.xib; 311 | sourceTree = ""; 312 | }; 313 | /* End PBXVariantGroup section */ 314 | 315 | /* Begin XCBuildConfiguration section */ 316 | 9A6CE5FD1BA6F15D009317D2 /* Debug */ = { 317 | isa = XCBuildConfiguration; 318 | buildSettings = { 319 | ALWAYS_SEARCH_USER_PATHS = NO; 320 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 321 | CLANG_CXX_LIBRARY = "libc++"; 322 | CLANG_ENABLE_MODULES = YES; 323 | CLANG_ENABLE_OBJC_ARC = YES; 324 | CLANG_WARN_BOOL_CONVERSION = YES; 325 | CLANG_WARN_CONSTANT_CONVERSION = YES; 326 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 327 | CLANG_WARN_EMPTY_BODY = YES; 328 | CLANG_WARN_ENUM_CONVERSION = YES; 329 | CLANG_WARN_INT_CONVERSION = YES; 330 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 331 | CLANG_WARN_UNREACHABLE_CODE = YES; 332 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 333 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 334 | COPY_PHASE_STRIP = NO; 335 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 336 | ENABLE_STRICT_OBJC_MSGSEND = YES; 337 | GCC_C_LANGUAGE_STANDARD = gnu99; 338 | GCC_DYNAMIC_NO_PIC = NO; 339 | GCC_NO_COMMON_BLOCKS = YES; 340 | GCC_OPTIMIZATION_LEVEL = 0; 341 | GCC_PREPROCESSOR_DEFINITIONS = ( 342 | "DEBUG=1", 343 | "$(inherited)", 344 | ); 345 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 348 | GCC_WARN_UNDECLARED_SELECTOR = YES; 349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 350 | GCC_WARN_UNUSED_FUNCTION = YES; 351 | GCC_WARN_UNUSED_VARIABLE = YES; 352 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 353 | MTL_ENABLE_DEBUG_INFO = YES; 354 | ONLY_ACTIVE_ARCH = YES; 355 | SDKROOT = iphoneos; 356 | TARGETED_DEVICE_FAMILY = "1,2"; 357 | }; 358 | name = Debug; 359 | }; 360 | 9A6CE5FE1BA6F15D009317D2 /* Release */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ALWAYS_SEARCH_USER_PATHS = NO; 364 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 365 | CLANG_CXX_LIBRARY = "libc++"; 366 | CLANG_ENABLE_MODULES = YES; 367 | CLANG_ENABLE_OBJC_ARC = YES; 368 | CLANG_WARN_BOOL_CONVERSION = YES; 369 | CLANG_WARN_CONSTANT_CONVERSION = YES; 370 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 371 | CLANG_WARN_EMPTY_BODY = YES; 372 | CLANG_WARN_ENUM_CONVERSION = YES; 373 | CLANG_WARN_INT_CONVERSION = YES; 374 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 375 | CLANG_WARN_UNREACHABLE_CODE = YES; 376 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 377 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 378 | COPY_PHASE_STRIP = NO; 379 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 380 | ENABLE_NS_ASSERTIONS = NO; 381 | ENABLE_STRICT_OBJC_MSGSEND = YES; 382 | GCC_C_LANGUAGE_STANDARD = gnu99; 383 | GCC_NO_COMMON_BLOCKS = YES; 384 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 385 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 386 | GCC_WARN_UNDECLARED_SELECTOR = YES; 387 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 388 | GCC_WARN_UNUSED_FUNCTION = YES; 389 | GCC_WARN_UNUSED_VARIABLE = YES; 390 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 391 | MTL_ENABLE_DEBUG_INFO = NO; 392 | SDKROOT = iphoneos; 393 | TARGETED_DEVICE_FAMILY = "1,2"; 394 | VALIDATE_PRODUCT = YES; 395 | }; 396 | name = Release; 397 | }; 398 | 9A6CE6001BA6F15D009317D2 /* Debug */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 402 | INFOPLIST_FILE = RW_DropdownMenu/Info.plist; 403 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 404 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 405 | PRODUCT_NAME = "$(TARGET_NAME)"; 406 | }; 407 | name = Debug; 408 | }; 409 | 9A6CE6011BA6F15D009317D2 /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | INFOPLIST_FILE = RW_DropdownMenu/Info.plist; 414 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 415 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 416 | PRODUCT_NAME = "$(TARGET_NAME)"; 417 | }; 418 | name = Release; 419 | }; 420 | 9A6CE6031BA6F15D009317D2 /* Debug */ = { 421 | isa = XCBuildConfiguration; 422 | buildSettings = { 423 | BUNDLE_LOADER = "$(TEST_HOST)"; 424 | FRAMEWORK_SEARCH_PATHS = ( 425 | "$(SDKROOT)/Developer/Library/Frameworks", 426 | "$(inherited)", 427 | ); 428 | GCC_PREPROCESSOR_DEFINITIONS = ( 429 | "DEBUG=1", 430 | "$(inherited)", 431 | ); 432 | INFOPLIST_FILE = RW_DropdownMenuTests/Info.plist; 433 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 434 | PRODUCT_NAME = "$(TARGET_NAME)"; 435 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RW_DropdownMenu.app/RW_DropdownMenu"; 436 | }; 437 | name = Debug; 438 | }; 439 | 9A6CE6041BA6F15D009317D2 /* Release */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | BUNDLE_LOADER = "$(TEST_HOST)"; 443 | FRAMEWORK_SEARCH_PATHS = ( 444 | "$(SDKROOT)/Developer/Library/Frameworks", 445 | "$(inherited)", 446 | ); 447 | INFOPLIST_FILE = RW_DropdownMenuTests/Info.plist; 448 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 449 | PRODUCT_NAME = "$(TARGET_NAME)"; 450 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RW_DropdownMenu.app/RW_DropdownMenu"; 451 | }; 452 | name = Release; 453 | }; 454 | /* End XCBuildConfiguration section */ 455 | 456 | /* Begin XCConfigurationList section */ 457 | 9A6CE5D71BA6F15D009317D2 /* Build configuration list for PBXProject "RW_DropdownMenu" */ = { 458 | isa = XCConfigurationList; 459 | buildConfigurations = ( 460 | 9A6CE5FD1BA6F15D009317D2 /* Debug */, 461 | 9A6CE5FE1BA6F15D009317D2 /* Release */, 462 | ); 463 | defaultConfigurationIsVisible = 0; 464 | defaultConfigurationName = Release; 465 | }; 466 | 9A6CE5FF1BA6F15D009317D2 /* Build configuration list for PBXNativeTarget "RW_DropdownMenu" */ = { 467 | isa = XCConfigurationList; 468 | buildConfigurations = ( 469 | 9A6CE6001BA6F15D009317D2 /* Debug */, 470 | 9A6CE6011BA6F15D009317D2 /* Release */, 471 | ); 472 | defaultConfigurationIsVisible = 0; 473 | defaultConfigurationName = Release; 474 | }; 475 | 9A6CE6021BA6F15D009317D2 /* Build configuration list for PBXNativeTarget "RW_DropdownMenuTests" */ = { 476 | isa = XCConfigurationList; 477 | buildConfigurations = ( 478 | 9A6CE6031BA6F15D009317D2 /* Debug */, 479 | 9A6CE6041BA6F15D009317D2 /* Release */, 480 | ); 481 | defaultConfigurationIsVisible = 0; 482 | defaultConfigurationName = Release; 483 | }; 484 | /* End XCConfigurationList section */ 485 | }; 486 | rootObject = 9A6CE5D41BA6F15D009317D2 /* Project object */; 487 | } 488 | --------------------------------------------------------------------------------