├── .gitignore ├── LICENSE ├── MultiSelectController ├── MultiSelectCell.h ├── MultiSelectCell.m ├── MultiSelectController.h ├── MultiSelectController.m ├── MultiSelectFlowLayout.h ├── MultiSelectFlowLayout.m ├── MultiSelectStoryBoard.storyboard └── cancel@3x.png ├── MultiSelectExample ├── MultiSelectExample.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── MultiSelectExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ └── LaunchScreen.xib │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── Main.storyboard │ ├── ViewController.h │ ├── ViewController.m │ └── main.m └── MultiSelectExampleTests │ ├── Info.plist │ └── MultiSelectExampleTests.m ├── README.md └── Screenshots ├── 1.png └── 2.png /.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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Darshan Patel 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 13 | all 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 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /MultiSelectController/MultiSelectCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCell.h 3 | // OptionSelection 4 | // 5 | // Created by Darshan Patel on 7/1/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | // The MIT License (MIT) 9 | // 10 | // Copyright (c) 2015 Darshan Patel 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | 30 | #import 31 | @protocol MultiSelectDelegate 32 | -(void)didCancelClicked:(NSString *)text; 33 | @end 34 | @interface MultiSelectCell : UICollectionViewCell 35 | @property (nonatomic,strong) IBOutlet UILabel *lblText; 36 | @property (nonatomic,strong) IBOutlet UIButton *btnCancel; 37 | @property (nonatomic,strong)id delegate; 38 | @end 39 | -------------------------------------------------------------------------------- /MultiSelectController/MultiSelectCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionViewCell.m 3 | // OptionSelection 4 | // 5 | // Created by Darshan Patel on 7/1/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | // The MIT License (MIT) 9 | // 10 | // Copyright (c) 2015 Darshan Patel 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | 30 | #import "MultiSelectCell.h" 31 | 32 | @implementation MultiSelectCell 33 | -(void)awakeFromNib 34 | { 35 | 36 | } 37 | -(IBAction)btnCancelTapped:(id)sender 38 | { 39 | if([self.delegate respondsToSelector:@selector(didCancelClicked:)]) 40 | { 41 | [self.delegate didCancelClicked:self.lblText.text]; 42 | } 43 | } 44 | @end 45 | -------------------------------------------------------------------------------- /MultiSelectController/MultiSelectController.h: -------------------------------------------------------------------------------- 1 | // 2 | // MultiSelectController.h 3 | // MultiSelectControl 4 | // 5 | // Created by Darshan Patel on 7/3/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | // The MIT License (MIT) 9 | // 10 | // Copyright (c) 2015 Darshan Patel 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | 30 | #import 31 | 32 | @class MultiSelectController; 33 | 34 | @protocol MultiSelectControlDelegate 35 | @required 36 | - (void)multiSelectControllerDidCancel:(MultiSelectController *)controller; 37 | - (void)multiSelectController:(MultiSelectController *)controller didFinishPickingSelections:(NSArray *)selections; 38 | @end 39 | 40 | @interface MultiSelectController : UIViewController 41 | 42 | @property (nonatomic,strong) IBOutlet NSLayoutConstraint *topLayoutConstraint; 43 | 44 | @property (nonatomic,strong) IBOutlet UICollectionView *multiSelectCollectionView; 45 | @property (nonatomic,strong) IBOutlet UITableView *tblOptions; 46 | @property (nonatomic,strong) NSMutableArray *arrOptions; 47 | 48 | @property (nonatomic,strong) id delegate; 49 | 50 | @property (nonatomic,strong) NSString *leftButtonText; 51 | @property (nonatomic,strong) NSString *rightButtonText; 52 | 53 | @property (nonatomic,strong) UIColor *leftButtonTextColor; 54 | @property (nonatomic,strong) UIColor *rightButtonTextColor; 55 | 56 | @property (nonatomic,strong) UIColor *multiSelectCellBackgroundColor; 57 | @property (nonatomic,strong) UIColor *tableTextColor; 58 | @property (nonatomic,strong) UIColor *multiSelectTextColor; 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /MultiSelectController/MultiSelectController.m: -------------------------------------------------------------------------------- 1 | // 2 | // MultiSelectController.m 3 | // MultiSelectControl 4 | // 5 | // Created by Darshan Patel on 7/3/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | // The MIT License (MIT) 9 | // 10 | // Copyright (c) 2015 Darshan Patel 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | 30 | #import "MultiSelectController.h" 31 | #import "MultiSelectCell.h" 32 | #import "MultiSelectFlowLayout.h" 33 | 34 | @interface MultiSelectController () 35 | @property (nonatomic,strong) NSMutableArray *arrSelected; 36 | @end 37 | 38 | @implementation MultiSelectController 39 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 40 | { 41 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 42 | if (self) { 43 | // Custom initialization 44 | } 45 | return self; 46 | } 47 | - (void)viewDidLoad { 48 | [super viewDidLoad]; 49 | 50 | self.automaticallyAdjustsScrollViewInsets = NO; 51 | self.arrSelected = [[NSMutableArray alloc] init]; 52 | 53 | if (!self.multiSelectCellBackgroundColor) { 54 | 55 | self.multiSelectCellBackgroundColor = [UIColor colorWithRed:52.0/255.0 green:152.0/255.0 blue:219.0/255.0 alpha:1.0]; 56 | } 57 | 58 | if (!self.tableTextColor) { 59 | 60 | self.tableTextColor = [UIColor blackColor]; 61 | 62 | } 63 | 64 | if (!self.multiSelectTextColor) { 65 | 66 | self.multiSelectTextColor = [UIColor whiteColor]; 67 | } 68 | 69 | 70 | 71 | [self navigationBarSetup]; 72 | [self collectionViewInitializations]; 73 | // Do any additional setup after loading the view from its nib. 74 | } 75 | - (void)viewWillDisappear:(BOOL)animated { 76 | [super viewWillDisappear:animated]; 77 | 78 | [self.arrSelected removeAllObjects]; 79 | [self.multiSelectCollectionView reloadData]; 80 | 81 | self.delegate = nil; 82 | } 83 | - (void)didReceiveMemoryWarning { 84 | [super didReceiveMemoryWarning]; 85 | // Dispose of any resources that can be recreated. 86 | } 87 | -(void)navigationBarSetup 88 | { 89 | 90 | if (!self.leftButtonTextColor) { 91 | 92 | self.leftButtonTextColor = [UIColor blackColor]; 93 | } 94 | 95 | 96 | if (!self.rightButtonTextColor) { 97 | 98 | self.rightButtonTextColor = [UIColor blackColor]; 99 | } 100 | 101 | 102 | if (!self.rightButtonText) { 103 | 104 | self.rightButtonText = @"Apply"; 105 | } 106 | 107 | 108 | if (!self.leftButtonText) { 109 | 110 | 111 | self.leftButtonText = @"Cancel"; 112 | } 113 | 114 | NSDictionary * navBarTitleTextAttributes = 115 | @{ NSForegroundColorAttributeName : [UIColor blackColor], 116 | NSFontAttributeName : [UIFont systemFontOfSize:16.0] }; 117 | 118 | self.navigationController.navigationBar.titleTextAttributes = navBarTitleTextAttributes; 119 | 120 | self.navigationItem.title = @"Select"; 121 | [self.navigationController.navigationBar setBarTintColor:[UIColor whiteColor]]; 122 | 123 | 124 | UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; 125 | spacer.width = -10; // for example shift right bar button to the right 126 | 127 | 128 | UIButton *btnCancel =[UIButton buttonWithType:UIButtonTypeCustom]; 129 | btnCancel.frame= CGRectMake(0, 0, 70, 32); 130 | [btnCancel setTitle:self.leftButtonText forState:UIControlStateNormal]; 131 | [btnCancel setTitleColor:self.leftButtonTextColor forState:UIControlStateNormal]; 132 | [btnCancel addTarget:self action:@selector(btnCancelTapped:) forControlEvents:UIControlEventTouchUpInside]; 133 | 134 | 135 | UIBarButtonItem *barCancel =[[UIBarButtonItem alloc] initWithCustomView:btnCancel]; 136 | self.navigationItem.leftBarButtonItems = @[spacer,barCancel]; 137 | 138 | 139 | UIBarButtonItem *spacera = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil]; 140 | spacera.width = -15; // for example shift right bar button to the right 141 | 142 | UIButton *btnApply =[UIButton buttonWithType:UIButtonTypeCustom]; 143 | btnApply.frame= CGRectMake(0, 0, 70, 32); 144 | [btnApply setTitle:self.rightButtonText forState:UIControlStateNormal]; 145 | [btnApply setTitleColor:self.rightButtonTextColor forState:UIControlStateNormal]; 146 | [btnApply addTarget:self action:@selector(btnApplyTapped:) forControlEvents:UIControlEventTouchUpInside]; 147 | 148 | 149 | 150 | UIBarButtonItem *barApply =[[UIBarButtonItem alloc] initWithCustomView:btnApply]; 151 | self.navigationItem.rightBarButtonItems = @[spacera,barApply]; 152 | 153 | 154 | 155 | 156 | 157 | } 158 | -(void)collectionViewInitializations 159 | { 160 | MultiSelectFlowLayout *flowLayout = [[MultiSelectFlowLayout alloc] init]; 161 | [flowLayout setItemSize:CGSizeMake(100, 30)]; 162 | [flowLayout setSectionInset:UIEdgeInsetsMake(0.0, 0.0, 0.0, 0.0)]; 163 | [flowLayout setMinimumLineSpacing:0.0]; 164 | [flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical]; 165 | [self.multiSelectCollectionView setCollectionViewLayout:flowLayout]; 166 | 167 | // [self.multiSelectCollectionView registerClass:[MultiSelectCell class] forCellWithReuseIdentifier:@"MultiSelectCell"]; 168 | 169 | } 170 | -(void)updateViewConstraints 171 | { 172 | [super updateViewConstraints]; 173 | 174 | if ([self.arrSelected count]!=0) { 175 | 176 | self.topLayoutConstraint.constant = 68; 177 | 178 | }else 179 | { 180 | self.topLayoutConstraint.constant = 0; 181 | } 182 | 183 | } 184 | -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 185 | { 186 | return 1; 187 | } 188 | - (NSInteger)tableView:(UITableView *)tableView 189 | numberOfRowsInSection:(NSInteger)section 190 | { 191 | return [self.arrOptions count]; 192 | } 193 | 194 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 195 | static NSString *CellIdentifier = @"Cell"; 196 | 197 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 198 | if (cell == nil) { 199 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] ; 200 | } 201 | 202 | cell.textLabel.text = self.arrOptions[indexPath.row]; 203 | cell.textLabel.textColor = self.tableTextColor; 204 | cell.backgroundColor = [UIColor clearColor]; 205 | cell.tintColor = self.multiSelectCellBackgroundColor; 206 | if ([self.arrSelected containsObject:self.arrOptions[indexPath.row]]) { 207 | 208 | cell.accessoryType = UITableViewCellAccessoryCheckmark; 209 | 210 | }else 211 | { 212 | cell.accessoryType = UITableViewCellAccessoryNone; 213 | } 214 | return cell; 215 | } 216 | -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 217 | { 218 | UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath]; 219 | 220 | if (cell.accessoryType == UITableViewCellAccessoryCheckmark) { 221 | 222 | cell.accessoryType = UITableViewCellAccessoryNone; 223 | 224 | [self.arrSelected removeObject:self.arrOptions[indexPath.row]]; 225 | [self.multiSelectCollectionView reloadData]; 226 | [self.view setNeedsUpdateConstraints]; 227 | 228 | 229 | }else 230 | { 231 | cell.accessoryType = UITableViewCellAccessoryCheckmark; 232 | 233 | [self.arrSelected addObject:self.arrOptions[indexPath.row]]; 234 | [self.multiSelectCollectionView reloadData]; 235 | 236 | [self.view setNeedsUpdateConstraints]; 237 | 238 | } 239 | 240 | } 241 | -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView 242 | { 243 | return 1; 244 | } 245 | -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 246 | { 247 | 248 | return [self.arrSelected count]; 249 | } 250 | -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 251 | { 252 | 253 | MultiSelectCell *cell = (MultiSelectCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"MultiSelectCell" forIndexPath:indexPath]; 254 | cell.delegate =self; 255 | cell.lblText.text = [self.arrSelected objectAtIndex:indexPath.row]; 256 | cell.lblText.textColor = self.multiSelectTextColor; 257 | cell.layer.cornerRadius = 3.0; 258 | cell.backgroundColor = self.multiSelectCellBackgroundColor; 259 | return cell; 260 | 261 | } 262 | - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath 263 | { 264 | ((MultiSelectCell*)cell).delegate = nil; 265 | } 266 | - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath 267 | { 268 | 269 | CGRect textRect = [[self.arrSelected objectAtIndex:indexPath.row] 270 | boundingRectWithSize:CGSizeMake(320, 30) 271 | options:NSStringDrawingUsesLineFragmentOrigin 272 | attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} 273 | 274 | context:nil]; 275 | 276 | return CGSizeMake(textRect.size.width+32, 30); 277 | 278 | } 279 | - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section 280 | { 281 | return 4; 282 | } 283 | 284 | 285 | -(void)didCancelClicked:(NSString *)text 286 | { 287 | [self.arrSelected removeObject:text]; 288 | [self.multiSelectCollectionView reloadData]; 289 | [self.tblOptions reloadData]; 290 | [self.view setNeedsUpdateConstraints]; 291 | 292 | } 293 | 294 | -(IBAction)btnCancelTapped:(id)sender 295 | { 296 | [self.navigationController dismissViewControllerAnimated:YES completion:^{ 297 | 298 | if ([self.delegate respondsToSelector:@selector(multiSelectControllerDidCancel:)]) { 299 | 300 | [self.delegate multiSelectControllerDidCancel:self]; 301 | } 302 | }]; 303 | } 304 | -(IBAction)btnApplyTapped:(id)sender 305 | { 306 | [self.navigationController dismissViewControllerAnimated:YES completion:^{ 307 | 308 | if ([self.delegate respondsToSelector:@selector(multiSelectController:didFinishPickingSelections:)]) { 309 | 310 | [self.delegate multiSelectController:self didFinishPickingSelections:self.arrSelected]; 311 | 312 | } 313 | }]; 314 | } 315 | /* 316 | #pragma mark - Navigation 317 | 318 | // In a storyboard-based application, you will often want to do a little preparation before navigation 319 | - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { 320 | // Get the new view controller using [segue destinationViewController]. 321 | // Pass the selected object to the new view controller. 322 | } 323 | */ 324 | 325 | @end 326 | -------------------------------------------------------------------------------- /MultiSelectController/MultiSelectFlowLayout.h: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionFlowLayout.h 3 | // OptionSelection 4 | // 5 | // Created by Darshan Patel on 7/1/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | // The MIT License (MIT) 9 | // 10 | // Copyright (c) 2015 Darshan Patel 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | 30 | #import 31 | 32 | @interface MultiSelectFlowLayout : UICollectionViewFlowLayout 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /MultiSelectController/MultiSelectFlowLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // CollectionFlowLayout.m 3 | // OptionSelection 4 | // 5 | // Created by Darshan Patel on 7/1/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | // The MIT License (MIT) 9 | // 10 | // Copyright (c) 2015 Darshan Patel 11 | // 12 | // Permission is hereby granted, free of charge, to any person obtaining a copy 13 | // of this software and associated documentation files (the "Software"), to deal 14 | // in the Software without restriction, including without limitation the rights 15 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 16 | // copies of the Software, and to permit persons to whom the Software is 17 | // furnished to do so, subject to the following conditions: 18 | // 19 | // The above copyright notice and this permission notice shall be included in 20 | // all copies or substantial portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 26 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 27 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 28 | // THE SOFTWARE. 29 | 30 | #import "MultiSelectFlowLayout.h" 31 | 32 | @implementation MultiSelectFlowLayout 33 | - (NSArray *) layoutAttributesForElementsInRect:(CGRect)rect { 34 | NSArray *answer = [super layoutAttributesForElementsInRect:rect]; 35 | 36 | for(int i = 0; i < [answer count]; ++i) { 37 | 38 | if (i==0) { 39 | UICollectionViewLayoutAttributes *currentLayoutAttributes = answer[i]; 40 | CGRect frame = currentLayoutAttributes.frame; 41 | frame.origin.x =2; 42 | currentLayoutAttributes.frame = frame; 43 | 44 | }else 45 | { 46 | UICollectionViewLayoutAttributes *currentLayoutAttributes = answer[i]; 47 | UICollectionViewLayoutAttributes *prevLayoutAttributes = answer[i - 1]; 48 | NSInteger maximumSpacing = 4; 49 | NSInteger origin = CGRectGetMaxX(prevLayoutAttributes.frame); 50 | if(origin + maximumSpacing + currentLayoutAttributes.frame.size.width < self.collectionViewContentSize.width) { 51 | CGRect frame = currentLayoutAttributes.frame; 52 | frame.origin.x = origin + maximumSpacing; 53 | frame.origin.y = prevLayoutAttributes.frame.origin.y; 54 | currentLayoutAttributes.frame = frame; 55 | }else 56 | { 57 | CGRect frame = currentLayoutAttributes.frame; 58 | frame.origin.x = 2; 59 | currentLayoutAttributes.frame = frame; 60 | } 61 | } 62 | 63 | } 64 | 65 | 66 | return answer; 67 | } 68 | @end 69 | -------------------------------------------------------------------------------- /MultiSelectController/MultiSelectStoryBoard.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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 42 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /MultiSelectController/cancel@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Darshanptl7500/MultiSelectController/23cdd4d44aadfa967a6d23fe907336482829f289/MultiSelectController/cancel@3x.png -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 7B74DFF01B6B412F00A22D2D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B74DFEF1B6B412F00A22D2D /* main.m */; }; 11 | 7B74DFF31B6B412F00A22D2D /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B74DFF21B6B412F00A22D2D /* AppDelegate.m */; }; 12 | 7B74DFFB1B6B412F00A22D2D /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B74DFFA1B6B412F00A22D2D /* Images.xcassets */; }; 13 | 7B74DFFE1B6B412F00A22D2D /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7B74DFFC1B6B412F00A22D2D /* LaunchScreen.xib */; }; 14 | 7B74E00A1B6B412F00A22D2D /* MultiSelectExampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B74E0091B6B412F00A22D2D /* MultiSelectExampleTests.m */; }; 15 | 7B74E01C1B6B414200A22D2D /* cancel@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 7B74E0141B6B414200A22D2D /* cancel@3x.png */; }; 16 | 7B74E01D1B6B414200A22D2D /* MultiSelectCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B74E0161B6B414200A22D2D /* MultiSelectCell.m */; }; 17 | 7B74E01E1B6B414200A22D2D /* MultiSelectController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B74E0181B6B414200A22D2D /* MultiSelectController.m */; }; 18 | 7B74E01F1B6B414200A22D2D /* MultiSelectFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B74E01A1B6B414200A22D2D /* MultiSelectFlowLayout.m */; }; 19 | 7B74E0201B6B414200A22D2D /* MultiSelectStoryBoard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B74E01B1B6B414200A22D2D /* MultiSelectStoryBoard.storyboard */; }; 20 | 7B74E0241B6B415C00A22D2D /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B74E0221B6B415C00A22D2D /* ViewController.m */; }; 21 | 7B74E0251B6B415C00A22D2D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B74E0231B6B415C00A22D2D /* Main.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | 7B74E0041B6B412F00A22D2D /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = 7B74DFE21B6B412F00A22D2D /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = 7B74DFE91B6B412F00A22D2D; 30 | remoteInfo = MultiSelectExample; 31 | }; 32 | /* End PBXContainerItemProxy section */ 33 | 34 | /* Begin PBXFileReference section */ 35 | 7B74DFEA1B6B412F00A22D2D /* MultiSelectExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MultiSelectExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 36 | 7B74DFEE1B6B412F00A22D2D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | 7B74DFEF1B6B412F00A22D2D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 38 | 7B74DFF11B6B412F00A22D2D /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 39 | 7B74DFF21B6B412F00A22D2D /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 40 | 7B74DFFA1B6B412F00A22D2D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 41 | 7B74DFFD1B6B412F00A22D2D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 42 | 7B74E0031B6B412F00A22D2D /* MultiSelectExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MultiSelectExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | 7B74E0081B6B412F00A22D2D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 44 | 7B74E0091B6B412F00A22D2D /* MultiSelectExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MultiSelectExampleTests.m; sourceTree = ""; }; 45 | 7B74E0141B6B414200A22D2D /* cancel@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "cancel@3x.png"; sourceTree = ""; }; 46 | 7B74E0151B6B414200A22D2D /* MultiSelectCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiSelectCell.h; sourceTree = ""; }; 47 | 7B74E0161B6B414200A22D2D /* MultiSelectCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultiSelectCell.m; sourceTree = ""; }; 48 | 7B74E0171B6B414200A22D2D /* MultiSelectController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiSelectController.h; sourceTree = ""; }; 49 | 7B74E0181B6B414200A22D2D /* MultiSelectController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultiSelectController.m; sourceTree = ""; }; 50 | 7B74E0191B6B414200A22D2D /* MultiSelectFlowLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiSelectFlowLayout.h; sourceTree = ""; }; 51 | 7B74E01A1B6B414200A22D2D /* MultiSelectFlowLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MultiSelectFlowLayout.m; sourceTree = ""; }; 52 | 7B74E01B1B6B414200A22D2D /* MultiSelectStoryBoard.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = MultiSelectStoryBoard.storyboard; sourceTree = ""; }; 53 | 7B74E0211B6B415C00A22D2D /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 54 | 7B74E0221B6B415C00A22D2D /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 55 | 7B74E0231B6B415C00A22D2D /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 7B74DFE71B6B412F00A22D2D /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | 7B74E0001B6B412F00A22D2D /* Frameworks */ = { 67 | isa = PBXFrameworksBuildPhase; 68 | buildActionMask = 2147483647; 69 | files = ( 70 | ); 71 | runOnlyForDeploymentPostprocessing = 0; 72 | }; 73 | /* End PBXFrameworksBuildPhase section */ 74 | 75 | /* Begin PBXGroup section */ 76 | 7B74DFE11B6B412F00A22D2D = { 77 | isa = PBXGroup; 78 | children = ( 79 | 7B74E0131B6B414200A22D2D /* MultiSelectController */, 80 | 7B74DFEC1B6B412F00A22D2D /* MultiSelectExample */, 81 | 7B74E0061B6B412F00A22D2D /* MultiSelectExampleTests */, 82 | 7B74DFEB1B6B412F00A22D2D /* Products */, 83 | ); 84 | sourceTree = ""; 85 | }; 86 | 7B74DFEB1B6B412F00A22D2D /* Products */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 7B74DFEA1B6B412F00A22D2D /* MultiSelectExample.app */, 90 | 7B74E0031B6B412F00A22D2D /* MultiSelectExampleTests.xctest */, 91 | ); 92 | name = Products; 93 | sourceTree = ""; 94 | }; 95 | 7B74DFEC1B6B412F00A22D2D /* MultiSelectExample */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | 7B74DFF11B6B412F00A22D2D /* AppDelegate.h */, 99 | 7B74DFF21B6B412F00A22D2D /* AppDelegate.m */, 100 | 7B74E0211B6B415C00A22D2D /* ViewController.h */, 101 | 7B74E0221B6B415C00A22D2D /* ViewController.m */, 102 | 7B74E0231B6B415C00A22D2D /* Main.storyboard */, 103 | 7B74DFFA1B6B412F00A22D2D /* Images.xcassets */, 104 | 7B74DFFC1B6B412F00A22D2D /* LaunchScreen.xib */, 105 | 7B74DFED1B6B412F00A22D2D /* Supporting Files */, 106 | ); 107 | path = MultiSelectExample; 108 | sourceTree = ""; 109 | }; 110 | 7B74DFED1B6B412F00A22D2D /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 7B74DFEE1B6B412F00A22D2D /* Info.plist */, 114 | 7B74DFEF1B6B412F00A22D2D /* main.m */, 115 | ); 116 | name = "Supporting Files"; 117 | sourceTree = ""; 118 | }; 119 | 7B74E0061B6B412F00A22D2D /* MultiSelectExampleTests */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | 7B74E0091B6B412F00A22D2D /* MultiSelectExampleTests.m */, 123 | 7B74E0071B6B412F00A22D2D /* Supporting Files */, 124 | ); 125 | path = MultiSelectExampleTests; 126 | sourceTree = ""; 127 | }; 128 | 7B74E0071B6B412F00A22D2D /* Supporting Files */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | 7B74E0081B6B412F00A22D2D /* Info.plist */, 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | 7B74E0131B6B414200A22D2D /* MultiSelectController */ = { 137 | isa = PBXGroup; 138 | children = ( 139 | 7B74E0141B6B414200A22D2D /* cancel@3x.png */, 140 | 7B74E0151B6B414200A22D2D /* MultiSelectCell.h */, 141 | 7B74E0161B6B414200A22D2D /* MultiSelectCell.m */, 142 | 7B74E0171B6B414200A22D2D /* MultiSelectController.h */, 143 | 7B74E0181B6B414200A22D2D /* MultiSelectController.m */, 144 | 7B74E0191B6B414200A22D2D /* MultiSelectFlowLayout.h */, 145 | 7B74E01A1B6B414200A22D2D /* MultiSelectFlowLayout.m */, 146 | 7B74E01B1B6B414200A22D2D /* MultiSelectStoryBoard.storyboard */, 147 | ); 148 | name = MultiSelectController; 149 | path = ../MultiSelectController; 150 | sourceTree = ""; 151 | }; 152 | /* End PBXGroup section */ 153 | 154 | /* Begin PBXNativeTarget section */ 155 | 7B74DFE91B6B412F00A22D2D /* MultiSelectExample */ = { 156 | isa = PBXNativeTarget; 157 | buildConfigurationList = 7B74E00D1B6B412F00A22D2D /* Build configuration list for PBXNativeTarget "MultiSelectExample" */; 158 | buildPhases = ( 159 | 7B74DFE61B6B412F00A22D2D /* Sources */, 160 | 7B74DFE71B6B412F00A22D2D /* Frameworks */, 161 | 7B74DFE81B6B412F00A22D2D /* Resources */, 162 | ); 163 | buildRules = ( 164 | ); 165 | dependencies = ( 166 | ); 167 | name = MultiSelectExample; 168 | productName = MultiSelectExample; 169 | productReference = 7B74DFEA1B6B412F00A22D2D /* MultiSelectExample.app */; 170 | productType = "com.apple.product-type.application"; 171 | }; 172 | 7B74E0021B6B412F00A22D2D /* MultiSelectExampleTests */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 7B74E0101B6B412F00A22D2D /* Build configuration list for PBXNativeTarget "MultiSelectExampleTests" */; 175 | buildPhases = ( 176 | 7B74DFFF1B6B412F00A22D2D /* Sources */, 177 | 7B74E0001B6B412F00A22D2D /* Frameworks */, 178 | 7B74E0011B6B412F00A22D2D /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | 7B74E0051B6B412F00A22D2D /* PBXTargetDependency */, 184 | ); 185 | name = MultiSelectExampleTests; 186 | productName = MultiSelectExampleTests; 187 | productReference = 7B74E0031B6B412F00A22D2D /* MultiSelectExampleTests.xctest */; 188 | productType = "com.apple.product-type.bundle.unit-test"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 7B74DFE21B6B412F00A22D2D /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastUpgradeCheck = 0640; 197 | ORGANIZATIONNAME = "Darshan Patel"; 198 | TargetAttributes = { 199 | 7B74DFE91B6B412F00A22D2D = { 200 | CreatedOnToolsVersion = 6.4; 201 | }; 202 | 7B74E0021B6B412F00A22D2D = { 203 | CreatedOnToolsVersion = 6.4; 204 | TestTargetID = 7B74DFE91B6B412F00A22D2D; 205 | }; 206 | }; 207 | }; 208 | buildConfigurationList = 7B74DFE51B6B412F00A22D2D /* Build configuration list for PBXProject "MultiSelectExample" */; 209 | compatibilityVersion = "Xcode 3.2"; 210 | developmentRegion = English; 211 | hasScannedForEncodings = 0; 212 | knownRegions = ( 213 | en, 214 | Base, 215 | ); 216 | mainGroup = 7B74DFE11B6B412F00A22D2D; 217 | productRefGroup = 7B74DFEB1B6B412F00A22D2D /* Products */; 218 | projectDirPath = ""; 219 | projectRoot = ""; 220 | targets = ( 221 | 7B74DFE91B6B412F00A22D2D /* MultiSelectExample */, 222 | 7B74E0021B6B412F00A22D2D /* MultiSelectExampleTests */, 223 | ); 224 | }; 225 | /* End PBXProject section */ 226 | 227 | /* Begin PBXResourcesBuildPhase section */ 228 | 7B74DFE81B6B412F00A22D2D /* Resources */ = { 229 | isa = PBXResourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 7B74E01C1B6B414200A22D2D /* cancel@3x.png in Resources */, 233 | 7B74E0251B6B415C00A22D2D /* Main.storyboard in Resources */, 234 | 7B74DFFE1B6B412F00A22D2D /* LaunchScreen.xib in Resources */, 235 | 7B74DFFB1B6B412F00A22D2D /* Images.xcassets in Resources */, 236 | 7B74E0201B6B414200A22D2D /* MultiSelectStoryBoard.storyboard in Resources */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | 7B74E0011B6B412F00A22D2D /* Resources */ = { 241 | isa = PBXResourcesBuildPhase; 242 | buildActionMask = 2147483647; 243 | files = ( 244 | ); 245 | runOnlyForDeploymentPostprocessing = 0; 246 | }; 247 | /* End PBXResourcesBuildPhase section */ 248 | 249 | /* Begin PBXSourcesBuildPhase section */ 250 | 7B74DFE61B6B412F00A22D2D /* Sources */ = { 251 | isa = PBXSourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | 7B74E0241B6B415C00A22D2D /* ViewController.m in Sources */, 255 | 7B74DFF31B6B412F00A22D2D /* AppDelegate.m in Sources */, 256 | 7B74E01E1B6B414200A22D2D /* MultiSelectController.m in Sources */, 257 | 7B74DFF01B6B412F00A22D2D /* main.m in Sources */, 258 | 7B74E01D1B6B414200A22D2D /* MultiSelectCell.m in Sources */, 259 | 7B74E01F1B6B414200A22D2D /* MultiSelectFlowLayout.m in Sources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | 7B74DFFF1B6B412F00A22D2D /* Sources */ = { 264 | isa = PBXSourcesBuildPhase; 265 | buildActionMask = 2147483647; 266 | files = ( 267 | 7B74E00A1B6B412F00A22D2D /* MultiSelectExampleTests.m in Sources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | /* End PBXSourcesBuildPhase section */ 272 | 273 | /* Begin PBXTargetDependency section */ 274 | 7B74E0051B6B412F00A22D2D /* PBXTargetDependency */ = { 275 | isa = PBXTargetDependency; 276 | target = 7B74DFE91B6B412F00A22D2D /* MultiSelectExample */; 277 | targetProxy = 7B74E0041B6B412F00A22D2D /* PBXContainerItemProxy */; 278 | }; 279 | /* End PBXTargetDependency section */ 280 | 281 | /* Begin PBXVariantGroup section */ 282 | 7B74DFFC1B6B412F00A22D2D /* LaunchScreen.xib */ = { 283 | isa = PBXVariantGroup; 284 | children = ( 285 | 7B74DFFD1B6B412F00A22D2D /* Base */, 286 | ); 287 | name = LaunchScreen.xib; 288 | sourceTree = ""; 289 | }; 290 | /* End PBXVariantGroup section */ 291 | 292 | /* Begin XCBuildConfiguration section */ 293 | 7B74E00B1B6B412F00A22D2D /* Debug */ = { 294 | isa = XCBuildConfiguration; 295 | buildSettings = { 296 | ALWAYS_SEARCH_USER_PATHS = NO; 297 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 298 | CLANG_CXX_LIBRARY = "libc++"; 299 | CLANG_ENABLE_MODULES = YES; 300 | CLANG_ENABLE_OBJC_ARC = YES; 301 | CLANG_WARN_BOOL_CONVERSION = YES; 302 | CLANG_WARN_CONSTANT_CONVERSION = YES; 303 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 304 | CLANG_WARN_EMPTY_BODY = YES; 305 | CLANG_WARN_ENUM_CONVERSION = YES; 306 | CLANG_WARN_INT_CONVERSION = YES; 307 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 308 | CLANG_WARN_UNREACHABLE_CODE = YES; 309 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 310 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 311 | COPY_PHASE_STRIP = NO; 312 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 313 | ENABLE_STRICT_OBJC_MSGSEND = YES; 314 | GCC_C_LANGUAGE_STANDARD = gnu99; 315 | GCC_DYNAMIC_NO_PIC = NO; 316 | GCC_NO_COMMON_BLOCKS = YES; 317 | GCC_OPTIMIZATION_LEVEL = 0; 318 | GCC_PREPROCESSOR_DEFINITIONS = ( 319 | "DEBUG=1", 320 | "$(inherited)", 321 | ); 322 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 323 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 324 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 325 | GCC_WARN_UNDECLARED_SELECTOR = YES; 326 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 327 | GCC_WARN_UNUSED_FUNCTION = YES; 328 | GCC_WARN_UNUSED_VARIABLE = YES; 329 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 330 | MTL_ENABLE_DEBUG_INFO = YES; 331 | ONLY_ACTIVE_ARCH = YES; 332 | SDKROOT = iphoneos; 333 | }; 334 | name = Debug; 335 | }; 336 | 7B74E00C1B6B412F00A22D2D /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ALWAYS_SEARCH_USER_PATHS = NO; 340 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 341 | CLANG_CXX_LIBRARY = "libc++"; 342 | CLANG_ENABLE_MODULES = YES; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | CLANG_WARN_BOOL_CONVERSION = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INT_CONVERSION = YES; 350 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 351 | CLANG_WARN_UNREACHABLE_CODE = YES; 352 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 353 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 354 | COPY_PHASE_STRIP = NO; 355 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 356 | ENABLE_NS_ASSERTIONS = NO; 357 | ENABLE_STRICT_OBJC_MSGSEND = YES; 358 | GCC_C_LANGUAGE_STANDARD = gnu99; 359 | GCC_NO_COMMON_BLOCKS = YES; 360 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 361 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 362 | GCC_WARN_UNDECLARED_SELECTOR = YES; 363 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 364 | GCC_WARN_UNUSED_FUNCTION = YES; 365 | GCC_WARN_UNUSED_VARIABLE = YES; 366 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 367 | MTL_ENABLE_DEBUG_INFO = NO; 368 | SDKROOT = iphoneos; 369 | VALIDATE_PRODUCT = YES; 370 | }; 371 | name = Release; 372 | }; 373 | 7B74E00E1B6B412F00A22D2D /* Debug */ = { 374 | isa = XCBuildConfiguration; 375 | buildSettings = { 376 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 377 | INFOPLIST_FILE = MultiSelectExample/Info.plist; 378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 379 | PRODUCT_NAME = "$(TARGET_NAME)"; 380 | }; 381 | name = Debug; 382 | }; 383 | 7B74E00F1B6B412F00A22D2D /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 387 | INFOPLIST_FILE = MultiSelectExample/Info.plist; 388 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 389 | PRODUCT_NAME = "$(TARGET_NAME)"; 390 | }; 391 | name = Release; 392 | }; 393 | 7B74E0111B6B412F00A22D2D /* Debug */ = { 394 | isa = XCBuildConfiguration; 395 | buildSettings = { 396 | BUNDLE_LOADER = "$(TEST_HOST)"; 397 | FRAMEWORK_SEARCH_PATHS = ( 398 | "$(SDKROOT)/Developer/Library/Frameworks", 399 | "$(inherited)", 400 | ); 401 | GCC_PREPROCESSOR_DEFINITIONS = ( 402 | "DEBUG=1", 403 | "$(inherited)", 404 | ); 405 | INFOPLIST_FILE = MultiSelectExampleTests/Info.plist; 406 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 407 | PRODUCT_NAME = "$(TARGET_NAME)"; 408 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MultiSelectExample.app/MultiSelectExample"; 409 | }; 410 | name = Debug; 411 | }; 412 | 7B74E0121B6B412F00A22D2D /* Release */ = { 413 | isa = XCBuildConfiguration; 414 | buildSettings = { 415 | BUNDLE_LOADER = "$(TEST_HOST)"; 416 | FRAMEWORK_SEARCH_PATHS = ( 417 | "$(SDKROOT)/Developer/Library/Frameworks", 418 | "$(inherited)", 419 | ); 420 | INFOPLIST_FILE = MultiSelectExampleTests/Info.plist; 421 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 422 | PRODUCT_NAME = "$(TARGET_NAME)"; 423 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/MultiSelectExample.app/MultiSelectExample"; 424 | }; 425 | name = Release; 426 | }; 427 | /* End XCBuildConfiguration section */ 428 | 429 | /* Begin XCConfigurationList section */ 430 | 7B74DFE51B6B412F00A22D2D /* Build configuration list for PBXProject "MultiSelectExample" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | 7B74E00B1B6B412F00A22D2D /* Debug */, 434 | 7B74E00C1B6B412F00A22D2D /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | defaultConfigurationName = Release; 438 | }; 439 | 7B74E00D1B6B412F00A22D2D /* Build configuration list for PBXNativeTarget "MultiSelectExample" */ = { 440 | isa = XCConfigurationList; 441 | buildConfigurations = ( 442 | 7B74E00E1B6B412F00A22D2D /* Debug */, 443 | 7B74E00F1B6B412F00A22D2D /* Release */, 444 | ); 445 | defaultConfigurationIsVisible = 0; 446 | }; 447 | 7B74E0101B6B412F00A22D2D /* Build configuration list for PBXNativeTarget "MultiSelectExampleTests" */ = { 448 | isa = XCConfigurationList; 449 | buildConfigurations = ( 450 | 7B74E0111B6B412F00A22D2D /* Debug */, 451 | 7B74E0121B6B412F00A22D2D /* Release */, 452 | ); 453 | defaultConfigurationIsVisible = 0; 454 | }; 455 | /* End XCConfigurationList section */ 456 | }; 457 | rootObject = 7B74DFE21B6B412F00A22D2D /* Project object */; 458 | } 459 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // MultiSelectExample 4 | // 5 | // Created by Darshan Patel on 7/31/15. 6 | // Copyright (c) 2015 Darshan Patel. 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 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // MultiSelectExample 4 | // 5 | // Created by Darshan Patel on 7/31/15. 6 | // Copyright (c) 2015 Darshan Patel. 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 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/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 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/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 | } -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.$(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 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // MultiSelectControl 4 | // 5 | // Created by Darshan Patel on 7/3/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // MultiSelectControl 4 | // 5 | // Created by Darshan Patel on 7/3/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "MultiSelectController.h" 11 | 12 | @interface ViewController () 13 | 14 | @end 15 | 16 | @implementation ViewController 17 | 18 | - (void)viewDidLoad { 19 | [super viewDidLoad]; 20 | // Do any additional setup after loading the view, typically from a nib. 21 | } 22 | 23 | - (void)didReceiveMemoryWarning { 24 | [super didReceiveMemoryWarning]; 25 | // Dispose of any resources that can be recreated. 26 | } 27 | -(IBAction)btnOpenTapped:(id)sender 28 | { 29 | UIStoryboard *storyboard =[UIStoryboard storyboardWithName:@"MultiSelectStoryBoard" bundle:nil]; 30 | 31 | MultiSelectController *multiSelect =[storyboard instantiateViewControllerWithIdentifier:@"MultiSelectController"]; 32 | multiSelect.delegate = self; 33 | multiSelect.multiSelectCellBackgroundColor =[UIColor colorWithRed:253.0/255.0 green:72.0/255.0 blue:47.0/255.0 alpha:1.0]; 34 | 35 | NSMutableArray *arrOptions =[[NSMutableArray alloc] initWithArray:@[@"India",@"United States",@"Canada",@"Australia",@"United Kingdom",@"Philippines",@"Japan",@"Italy",@"Germany",@"Russia",@"Malaysia",@"France",@"Sweden",@"New Zealand",@"Singapore"]]; 36 | 37 | multiSelect.arrOptions =arrOptions; 38 | 39 | multiSelect.leftButtonText = @"Cancel"; 40 | multiSelect.leftButtonTextColor = [UIColor blackColor]; 41 | 42 | multiSelect.rightButtonText = @"Apply"; 43 | multiSelect.rightButtonTextColor = [UIColor blackColor]; 44 | 45 | UINavigationController *navi =[[UINavigationController alloc] initWithRootViewController:multiSelect]; 46 | 47 | [self.navigationController presentViewController:navi animated:YES completion:^{ 48 | 49 | 50 | }]; 51 | } 52 | -(void)multiSelectControllerDidCancel:(MultiSelectController *)controller 53 | { 54 | 55 | } 56 | -(void)multiSelectController:(MultiSelectController *)controller didFinishPickingSelections:(NSArray *)selections 57 | { 58 | NSLog(@"%@",selections); 59 | } 60 | @end 61 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MultiSelectExample 4 | // 5 | // Created by Darshan Patel on 7/31/15. 6 | // Copyright (c) 2015 Darshan Patel. 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 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.$(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 | -------------------------------------------------------------------------------- /MultiSelectExample/MultiSelectExampleTests/MultiSelectExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // MultiSelectExampleTests.m 3 | // MultiSelectExampleTests 4 | // 5 | // Created by Darshan Patel on 7/31/15. 6 | // Copyright (c) 2015 Darshan Patel. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface MultiSelectExampleTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation MultiSelectExampleTests 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 | # MultiSelectController 2 | 3 | MultiSelectController is useful for making multiple selection with see selection on the top of controller. 4 | 5 | ## Screenshot 6 | 7 | ![1](https://raw.githubusercontent.com/Darshanptl7500/MultiSelectController/master/Screenshots/1.png)![2](https://raw.githubusercontent.com/Darshanptl7500/MultiSelectController/master/Screenshots/2.png) 8 | 9 | ##How To Use 10 | 11 | 1. Download the repository and add the files from MultiSelectController folder file in your project. 12 | 13 | ``` 14 | 15 | MultiSelectController *multiSelect =[storyboard instantiateViewControllerWithIdentifier:@"MultiSelectController"]; 16 | multiSelect.delegate = self; 17 | multiSelect.multiSelectCellBackgroundColor =[UIColor colorWithRed:253.0/255.0 green:72.0/255.0 blue:47.0/255.0 alpha:1.0]; 18 | 19 | NSMutableArray *arrOptions =[[NSMutableArray alloc] initWithArray:@[@"India",@"United States",@"Canada",@"Australia",@"United Kingdom",@"Philippines",@"Japan",@"Italy",@"Germany",@"Russia",@"Malaysia",@"France",@"Sweden",@"New Zealand",@"Singapore"]]; 20 | 21 | multiSelect.arrOptions =arrOptions; 22 | 23 | multiSelect.leftButtonText = @"Cancel"; 24 | multiSelect.leftButtonTextColor = [UIColor blackColor]; 25 | 26 | multiSelect.rightButtonText = @"Apply"; 27 | multiSelect.rightButtonTextColor = [UIColor blackColor]; 28 | 29 | UINavigationController *navi =[[UINavigationController alloc] initWithRootViewController:multiSelect]; 30 | 31 | [self.navigationController presentViewController:navi animated:YES completion:^{ 32 | 33 | 34 | }]; 35 | 36 | 37 | ``` 38 | you can see example for more understanding. 39 | 40 | ##Compatibility 41 | 42 | - iOS 7.0+ 43 | 44 | ##Android 45 | 46 | - Please check [FilterSelectorListView](https://github.com/pchauhan/FilterSelectorListView) for android 47 | 48 | ##License 49 | The MIT License (MIT) 50 | 51 | Copyright (c) 2015 Darshan Patel 52 | 53 | Permission is hereby granted, free of charge, to any person obtaining a copy 54 | of this software and associated documentation files (the "Software"), to deal 55 | in the Software without restriction, including without limitation the rights 56 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 57 | copies of the Software, and to permit persons to whom the Software is 58 | furnished to do so, subject to the following conditions: 59 | 60 | The above copyright notice and this permission notice shall be included in 61 | all copies or substantial portions of the Software. 62 | 63 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 64 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 65 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 66 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 67 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 68 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 69 | THE SOFTWARE. 70 | -------------------------------------------------------------------------------- /Screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Darshanptl7500/MultiSelectController/23cdd4d44aadfa967a6d23fe907336482829f289/Screenshots/1.png -------------------------------------------------------------------------------- /Screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Darshanptl7500/MultiSelectController/23cdd4d44aadfa967a6d23fe907336482829f289/Screenshots/2.png --------------------------------------------------------------------------------