├── screenshot.gif
├── MGCollapsableTableView.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
└── project.pbxproj
├── MGCollapsableTableView
├── ViewController.h
├── AppDelegate.h
├── main.m
├── Style1
│ ├── Style1TableViewController.h
│ ├── Style1TableViewHeaderView.h
│ ├── Style1TableViewHeaderView.m
│ ├── Style1TableViewController.m
│ └── Style1TableViewHeaderView.xib
├── Base
│ ├── UITableView+VisibleSections.h
│ ├── MGCollapsableTableViewSectionSource.m
│ ├── MGCollapsableTableViewSectionViewBase.h
│ ├── MGCollapsableTableViewSectionSource.h
│ ├── MGCollapsableTableViewController.h
│ ├── UITableView+VisibleSections.m
│ └── MGCollapsableTableViewController.m
├── ViewController.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
└── AppDelegate.m
├── .gitignore
├── LICENSE
└── README.md
/screenshot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mgenware/MGCollapsableTableView/HEAD/screenshot.gif
--------------------------------------------------------------------------------
/MGCollapsableTableView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. 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 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. 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 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Style1/Style1TableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // Style1TableViewController.h
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import
11 | #import "MGCollapsableTableViewController.h"
12 |
13 | @interface Style1TableViewController : MGCollapsableTableViewController
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Base/UITableView+VisibleSections.h:
--------------------------------------------------------------------------------
1 | //
2 | // Original Source: http://stackoverflow.com/questions/15204328/how-to-retrieve-all-visible-table-section-header-views/
3 | //
4 |
5 | #import
6 |
7 | @interface UITableView (VisibleSections)
8 |
9 | // Returns an array of NSNumbers of the current visible section indexes
10 | - (NSArray *)indexesOfVisibleSections;
11 | // Returns an array of UITableViewHeaderFooterView objects of the current visible section headers
12 | - (NSArray *)visibleSections;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 |
11 | @interface ViewController ()
12 |
13 | @end
14 |
15 | @implementation ViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | // Do any additional setup after loading the view, typically from a nib.
20 | }
21 |
22 | - (void)didReceiveMemoryWarning {
23 | [super didReceiveMemoryWarning];
24 | // Dispose of any resources that can be recreated.
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Style1/Style1TableViewHeaderView.h:
--------------------------------------------------------------------------------
1 | //
2 | // Style1TableViewHeaderView.h
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import
11 | #import "MGCollapsableTableViewSectionViewBase.h"
12 |
13 | @interface Style1TableViewHeaderView : UITableViewHeaderFooterView
14 |
15 | @property (nonatomic, weak) id delegate;
16 | @property (nonatomic, assign) BOOL tableViewSectionCollapsed;
17 |
18 | @property (strong, nonatomic) IBOutlet UILabel *headerTextLabel;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Assets.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 | }
--------------------------------------------------------------------------------
/MGCollapsableTableView/Base/MGCollapsableTableViewSectionSource.m:
--------------------------------------------------------------------------------
1 | //
2 | // MGCollapsableTableViewSectionSource.m
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/11.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import "MGCollapsableTableViewSectionSource.h"
11 |
12 | @implementation MGCollapsableTableViewSectionSource
13 |
14 | - (instancetype)initWithSectionInfo:(id)sectionInfo rows:(NSArray *)rows {
15 | self = [super init];
16 | if (self) {
17 | _sectionInfo = sectionInfo;
18 | _rows = rows;
19 | }
20 |
21 | return self;
22 | }
23 |
24 | - (instancetype)initWithRows:(NSArray *)rows {
25 | return [self initWithSectionInfo:nil rows:rows];
26 | }
27 |
28 | - (id)objectAtIndex:(NSUInteger)index {
29 | return [self.rows objectAtIndex:index];
30 | }
31 |
32 | @end
33 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Base/MGCollapsableTableViewSectionViewBase.h:
--------------------------------------------------------------------------------
1 | //
2 | // MGCollapsableTableViewSectionBase.h
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import
11 |
12 | @protocol MGCollapsableTableViewSectionViewBaseDelegate
13 |
14 | @optional
15 |
16 | /**
17 | * Invoked when Section View's tableViewSectionCollapsed property changes.
18 | */
19 | - (void)collapseableSection:(id)sectionView isCollapsed:(BOOL)isCollapsed;
20 |
21 | @end
22 |
23 |
24 | @protocol MGCollapsableTableViewSectionViewBase
25 |
26 | @required
27 |
28 | /**
29 | * Delegates section view's events.
30 | */
31 | @property (nonatomic, weak) id delegate;
32 |
33 | /**
34 | * Indicates whether this section view is collapsed.
35 | */
36 | @property (nonatomic, assign) BOOL tableViewSectionCollapsed;
37 |
38 | @end
39 |
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Mgen
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Base/MGCollapsableTableViewSectionSource.h:
--------------------------------------------------------------------------------
1 | //
2 | // MGCollapsableTableViewSectionSource.h
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/11.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import
11 |
12 | /**
13 | * Section data object
14 | */
15 | @interface MGCollapsableTableViewSectionSource : NSObject
16 |
17 | /**
18 | * Custom section info.
19 | */
20 | @property (nonatomic, strong) id sectionInfo;
21 |
22 | /**
23 | * Indicates whether this section is collapsed.
24 | */
25 | @property (nonatomic, assign) BOOL collapsed;
26 |
27 | /**
28 | * Custom data for each rows.
29 | */
30 | @property (nonatomic, strong) NSArray *rows;
31 |
32 | /**
33 | * Creates a MGCollapsableTableViewSectionSource object with custom row data.
34 | */
35 | - (instancetype)initWithRows:(NSArray *)rows;
36 |
37 | /**
38 | * Creates a MGCollapsableTableViewSectionSource object with custom section info and row data.
39 | */
40 | - (instancetype)initWithSectionInfo:(id)sectionInfo rows:(NSArray *)rows;
41 |
42 | /**
43 | * A shortcut for [self.rows objectAtIndex:index].
44 | */
45 | - (id)objectAtIndex:(NSUInteger)index;
46 |
47 | @end
48 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
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 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Style1/Style1TableViewHeaderView.m:
--------------------------------------------------------------------------------
1 | //
2 | // Style1TableViewHeaderView.m
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import "Style1TableViewHeaderView.h"
11 |
12 | @interface Style1TableViewHeaderView ()
13 |
14 | @property (strong, nonatomic) IBOutlet UILabel *indicatorLabel;
15 |
16 | @end
17 |
18 | @implementation Style1TableViewHeaderView
19 |
20 | - (void)awakeFromNib {
21 | [super awakeFromNib];
22 |
23 | UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(contentViewClick:)];
24 | [self addGestureRecognizer:tapGesture];
25 | }
26 |
27 | - (IBAction)contentViewClick:(id)sender {
28 | [self toggleState];
29 | }
30 |
31 | - (void)toggleState {
32 | self.tableViewSectionCollapsed = !self.tableViewSectionCollapsed;
33 | [self notifyDelegate];
34 | }
35 |
36 | - (void)setTableViewSectionCollapsed:(BOOL)tableViewSectionCollapsed {
37 | _tableViewSectionCollapsed = tableViewSectionCollapsed;
38 | [self refreshIndicator];
39 | }
40 |
41 | - (void)refreshIndicator {
42 | self.indicatorLabel.text = self.tableViewSectionCollapsed ? @"+" : @"-";
43 | }
44 |
45 | - (void)notifyDelegate {
46 | if ([self.delegate respondsToSelector:@selector(collapseableSection:isCollapsed:)]) {
47 | [self.delegate collapseableSection:self isCollapsed:self.tableViewSectionCollapsed];
48 | }
49 | }
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Base/MGCollapsableTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MGCollapsableTableViewController.h
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import
11 | #import "MGCollapsableTableViewSectionViewBase.h"
12 | #import "MGCollapsableTableViewSectionSource.h"
13 |
14 | /**
15 | * Base class for implementing a collapsable UITableViewController
16 | */
17 | @interface MGCollapsableTableViewController : UITableViewController
18 |
19 | /**
20 | * Section data, array of MGCollapsableTableViewSectionSource object.
21 | */
22 | @property (nonatomic, strong) NSArray *sections;
23 |
24 | /**
25 | * Note to subclass implementation: call this method in "- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section", this method will delegate UI(MGCollapsableTableViewSectionViewBase object) events to UITableViewController.
26 | */
27 | - (id)setupCollapsableSection:(id)sectionView sectionIndex:(NSInteger)sectionIndex;
28 |
29 | /**
30 | * Collapses all section headers.
31 | */
32 | - (void)collapseAllSections;
33 |
34 | /**
35 | * Expands all section headers.
36 | */
37 | - (void)expandAllSections;
38 |
39 | /**
40 | * Collapses a section header by specified index.
41 | */
42 | - (void)collapseSection:(NSUInteger)section;
43 |
44 | /**
45 | * Expands a section header by specified index.
46 | */
47 | - (void)expandSection:(NSUInteger)section;
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MGCollapsableTableViewController
2 | Collapsable UITableView Sections.
3 |
4 | * Xcode 7 or higher.
5 | * iOS 6.0 or higher.
6 |
7 | ## Screenshot
8 | [](screenshot.gif?raw=true)
9 |
10 | ## Sample Project
11 | Download the whole project or clone this Git repository.
12 |
13 | ## Usage
14 | * The `./Base` folder, which contains all required source files, should be copied to your project.
15 | * Implement your own section header view with `MGCollapsableTableViewSectionViewBase` protocol.
16 | * Implement the `delegate` property.
17 | * Invoke `delegate`'s `- (void)collapseableSection:(id)sectionView isCollapsed:(BOOL)isCollapsed` on header view events, e.g. when user taps on header view.
18 | * Implement the `tableViewSectionCollapsed` property, note that its getter and setter are used to obtain or change the state of the header view, **you should not invoke `delegate` methods when `tableViewSectionCollapsed` changes**.
19 | * Implement your own `UITableViewController` by subclassing `MGCollapsableTableViewController`.
20 | * Create an array of `MGCollapsableTableViewSectionSource` objects as the data source for UITableView.
21 | * Implement `- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section` and return your desired header view height.
22 | * Implement `- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section`. You **must call `[self setupCollapsableSection:sectionIndex:]` on each section view object** in order to delegate header view events to `UITableViewController`.
23 | * Implement other necessary methods(`cellForRowAtIndexPath`...).
24 | * Call `collapseSection`, `expandSection`, `collapseAllSections`, `expandAllSections` if you want to programmatically control the state of a(all) section(s).
25 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Base.lproj/LaunchScreen.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 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Base/UITableView+VisibleSections.m:
--------------------------------------------------------------------------------
1 |
2 | #import "UITableView+VisibleSections.h"
3 |
4 | @implementation UITableView (VisibleSections)
5 |
6 | - (NSArray *)indexesOfVisibleSections {
7 | // Note: We can't just use indexPathsForVisibleRows, since it won't return index paths for empty sections.
8 | NSMutableArray *visibleSectionIndexes = [NSMutableArray arrayWithCapacity:self.numberOfSections];
9 | for (int i = 0; i < self.numberOfSections; i++) {
10 | CGRect headerRect;
11 | // In plain style, the section headers are floating on the top, so the section header is visible if any part of the section's rect is still visible.
12 | // In grouped style, the section headers are not floating, so the section header is only visible if it's actualy rect is visible.
13 | if (self.style == UITableViewStylePlain) {
14 | headerRect = [self rectForSection:i];
15 | } else {
16 | headerRect = [self rectForHeaderInSection:i];
17 | }
18 | // The "visible part" of the tableView is based on the content offset and the tableView's size.
19 | CGRect visiblePartOfTableView = CGRectMake(self.contentOffset.x, self.contentOffset.y, self.bounds.size.width, self.bounds.size.height);
20 | if (CGRectIntersectsRect(visiblePartOfTableView, headerRect)) {
21 | [visibleSectionIndexes addObject:@(i)];
22 | }
23 | }
24 | return visibleSectionIndexes;
25 | }
26 |
27 | - (NSArray *)visibleSections {
28 | NSMutableArray *visibleSects = [NSMutableArray arrayWithCapacity:self.numberOfSections];
29 | for (NSNumber *sectionIndex in self.indexesOfVisibleSections) {
30 | UITableViewHeaderFooterView *sectionHeader = [self headerViewForSection:sectionIndex.intValue];
31 | [visibleSects addObject:sectionHeader];
32 | }
33 |
34 | return visibleSects;
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. 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 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Style1/Style1TableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // Style1TableViewController.m
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import "Style1TableViewController.h"
11 | #import "Style1TableViewHeaderView.h"
12 |
13 | #define kSectionHeaderHeight 40.0
14 | #define kCellHeight 30.0
15 | #define kCellID @"Cell"
16 | #define kSectionHeaderID @"SectionHeader"
17 |
18 | @interface Style1TableViewController ()
19 | @property (strong, nonatomic) IBOutlet UIBarButtonItem *rightBarButton;
20 | @property (assign, nonatomic) BOOL rightBarButtonExpandAllFlag;
21 |
22 | @end
23 |
24 | @implementation Style1TableViewController
25 |
26 | - (void)viewDidLoad {
27 | [super viewDidLoad];
28 |
29 | NSMutableArray *dataSource = [NSMutableArray array];
30 | for (int i = 0; i < 50; i++) {
31 | NSMutableArray *cells = [NSMutableArray array];
32 | for (int j = 0; j < 5; j++) {
33 | [cells addObject:[NSString stringWithFormat:@"Cell %@", @(j + 1)]];
34 | }
35 |
36 | MGCollapsableTableViewSectionSource *section = [[MGCollapsableTableViewSectionSource alloc] initWithSectionInfo:[NSString stringWithFormat:@"Section %@", @(i + 1)] rows:cells];
37 | [dataSource addObject:section];
38 | }
39 |
40 | self.sections = dataSource;
41 |
42 | int i = 1;
43 | for (MGCollapsableTableViewSectionSource *sectionSource in self.sections) {
44 | sectionSource.sectionInfo = [NSString stringWithFormat:@"Section - %@", @(i)];
45 | i++;
46 | }
47 |
48 | [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellID];
49 | [self.tableView registerNib:[UINib nibWithNibName:@"Style1TableViewHeaderView" bundle:nil] forHeaderFooterViewReuseIdentifier:kSectionHeaderID];
50 |
51 | [self refreshRightBarButtonText];
52 | }
53 |
54 | - (IBAction)rightButtonClick:(id)sender {
55 | if (_rightBarButtonExpandAllFlag) {
56 | [self expandAllSections];
57 | } else {
58 | [self collapseAllSections];
59 | }
60 | _rightBarButtonExpandAllFlag = !_rightBarButtonExpandAllFlag;
61 | [self refreshRightBarButtonText];
62 | }
63 |
64 | - (void)refreshRightBarButtonText {
65 | [_rightBarButton setTitle:_rightBarButtonExpandAllFlag ? @"Expand All" : @"Collapse All"];
66 | }
67 |
68 | #pragma mark -
69 | #pragma mark UITableView DataSource
70 |
71 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
72 | return kSectionHeaderHeight;
73 | }
74 |
75 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
76 | UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kCellID forIndexPath:indexPath];
77 |
78 | NSString *text = [self.sections[indexPath.section] objectAtIndex:indexPath.row];
79 | cell.textLabel.text = text;
80 |
81 | return cell;
82 | }
83 |
84 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
85 | Style1TableViewHeaderView *headerView = [self.tableView dequeueReusableHeaderFooterViewWithIdentifier:kSectionHeaderID];
86 |
87 | [self setupCollapsableSection:headerView sectionIndex:section];
88 |
89 | MGCollapsableTableViewSectionSource *sectionSource = self.sections[section];
90 |
91 | headerView.headerTextLabel.text = sectionSource.sectionInfo;
92 | headerView.tableViewSectionCollapsed = sectionSource.collapsed;
93 |
94 | return headerView;
95 | }
96 |
97 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
98 | return kCellHeight;
99 | }
100 |
101 | @end
102 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Style1/Style1TableViewHeaderView.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
24 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/Base/MGCollapsableTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // MGCollapsableTableViewController.m
3 | // MGCollapsableTableView
4 | //
5 | // Created by Mgen on 15/11/10.
6 | // Copyright © 2015 Mgen. All rights reserved.
7 | // https://github.com/mgenware/MGCollapsableTableView
8 | //
9 |
10 | #import "MGCollapsableTableViewController.h"
11 | #import "UITableView+VisibleSections.h"
12 |
13 | @interface MGCollapsableTableViewController ()
14 | {
15 | }
16 | @end
17 |
18 | @implementation MGCollapsableTableViewController
19 |
20 | - (void)viewDidLoad {
21 | [super viewDidLoad];
22 | }
23 |
24 | - (void)didReceiveMemoryWarning {
25 | [super didReceiveMemoryWarning];
26 | // Dispose of any resources that can be recreated.
27 | }
28 |
29 | #pragma mark -
30 | #pragma mark Public Methods
31 |
32 | /**
33 | * Note to subclass: call this method in "- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section", this will delegate MGCollapsableTableViewSectionViewBase events to UITableViewController.
34 | */
35 | - (id)setupCollapsableSection:(UIView *)sectionView sectionIndex:(NSInteger)sectionIndex {
36 |
37 | NSAssert(sectionView, @"sectionView cannot be nil");
38 | sectionView.delegate = self;
39 | sectionView.tag = sectionIndex;
40 | return sectionView;
41 | }
42 |
43 | /**
44 | * Collapse all section headers.
45 | */
46 | - (void)collapseAllSections {
47 | [self batchSetSectionState:YES];
48 | }
49 |
50 | /**
51 | * Expand all section headers.
52 | */
53 | - (void)expandAllSections {
54 | [self batchSetSectionState:NO];
55 | }
56 |
57 | - (void)collapseSection:(NSUInteger)section {
58 | [self setSectionState:section collapsed:YES];
59 | }
60 |
61 | - (void)expandSection:(NSUInteger)section {
62 | [self setSectionState:section collapsed:NO];
63 | }
64 |
65 | #pragma mark -
66 | #pragma mark Internal Methods
67 |
68 | - (void)setSectionState:(NSUInteger)section collapsed:(BOOL)collapsed {
69 | [self.tableView beginUpdates];
70 | [self setSectionState:section isCollapsed:collapsed];
71 | [self.tableView reloadSections:[[NSIndexSet alloc] initWithIndex:section] withRowAnimation:UITableViewRowAnimationFade];
72 | [self.tableView endUpdates];
73 | }
74 |
75 | - (void)batchSetSectionState:(BOOL)collapsed {
76 | [self.tableView beginUpdates];
77 | for (int i = 0; i < [self.tableView numberOfSections]; i++) {
78 | [self setSectionState:i isCollapsed:collapsed];
79 | }
80 | [self reloadVisibleSections];
81 | [self.tableView endUpdates];
82 | }
83 |
84 | /**
85 | * Returns an array of all NSIndexPath objects from a section index
86 | */
87 | - (NSArray *)allIndexPathsFromSection:(NSInteger)section {
88 | NSInteger numOfRows = [self.sections[section] rows].count;
89 | NSMutableArray *indexPaths = [NSMutableArray array];
90 | for (int i = 0; i < numOfRows; i++) {
91 | [indexPaths addObject:[NSIndexPath indexPathForRow:i inSection:section]];
92 | }
93 | return indexPaths;
94 | }
95 |
96 | /**
97 | * Returns section index from a section view.
98 | */
99 | - (NSInteger)collapsableSectionIndexFromSectionView:(UIView *)sectionView {
100 | NSAssert(sectionView, @"sectionView cannot be nil");
101 | return sectionView.tag;
102 | }
103 |
104 | /**
105 | * Reloads all visible sections in UITableView.
106 | */
107 | - (void)reloadVisibleSections {
108 | NSMutableIndexSet *visibleSections = [[NSMutableIndexSet alloc] init];
109 | NSArray *sectionArray = [self.tableView indexesOfVisibleSections];
110 | for (NSNumber *index in sectionArray) {
111 | [visibleSections addIndex:[index unsignedIntegerValue]];
112 | }
113 |
114 | [self.tableView reloadSections:visibleSections withRowAnimation:UITableViewRowAnimationFade];
115 | }
116 |
117 | /**
118 | * This will set collapsed property on internal section data object(MGCollapsableTableViewSectionSource) and update UITableView section.
119 | */
120 | - (void)setSectionState:(NSUInteger)section isCollapsed:(BOOL)isCollapsed {
121 | MGCollapsableTableViewSectionSource *sectionSource = _sections[section];
122 | if (sectionSource.collapsed == isCollapsed) {
123 | return;
124 | }
125 |
126 | NSArray *indexPaths = [self allIndexPathsFromSection:section];
127 | sectionSource.collapsed = isCollapsed;
128 |
129 | if (isCollapsed) {
130 | [self.tableView deleteRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
131 | } else {
132 | [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationTop];
133 | }
134 | }
135 |
136 | #pragma mark -
137 | #pragma mark UITableView DataSource
138 |
139 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
140 | NSAssert(_sections, @"sections cannot be nil");
141 |
142 | return _sections.count;
143 | }
144 |
145 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
146 | MGCollapsableTableViewSectionSource *sectionSource = _sections[section];
147 | if (sectionSource.collapsed) {
148 | return 0;
149 | }
150 | return sectionSource.rows.count;
151 | }
152 |
153 | #pragma mark -
154 | #pragma mark MGCollapsableTableViewSectionBaseDelegate
155 |
156 | - (void)collapseableSection:(id)sectionView isCollapsed:(BOOL)isCollapsed {
157 | NSInteger sectionIndex = [self collapsableSectionIndexFromSectionView:sectionView];
158 |
159 | [self.tableView beginUpdates];
160 | [self setSectionState:sectionIndex isCollapsed:isCollapsed];
161 | [self.tableView endUpdates];
162 | }
163 |
164 | @end
165 |
--------------------------------------------------------------------------------
/MGCollapsableTableView/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 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/MGCollapsableTableView.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5A2AB8681BF197F500B216C2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A2AB8671BF197F500B216C2 /* main.m */; };
11 | 5A2AB86B1BF197F500B216C2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A2AB86A1BF197F500B216C2 /* AppDelegate.m */; };
12 | 5A2AB86E1BF197F500B216C2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A2AB86D1BF197F500B216C2 /* ViewController.m */; };
13 | 5A2AB8711BF197F500B216C2 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5A2AB86F1BF197F500B216C2 /* Main.storyboard */; };
14 | 5A2AB8731BF197F500B216C2 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5A2AB8721BF197F500B216C2 /* Assets.xcassets */; };
15 | 5A2AB8761BF197F500B216C2 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5A2AB8741BF197F500B216C2 /* LaunchScreen.storyboard */; };
16 | 5A2AB8801BF1983400B216C2 /* MGCollapsableTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A2AB87F1BF1983400B216C2 /* MGCollapsableTableViewController.m */; };
17 | 5A2AB8881BF1B9FC00B216C2 /* Style1TableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A2AB8871BF1B9FC00B216C2 /* Style1TableViewController.m */; };
18 | 5A2AB88A1BF1BD0E00B216C2 /* Style1TableViewHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 5A2AB8891BF1BD0E00B216C2 /* Style1TableViewHeaderView.xib */; };
19 | 5A2AB88D1BF1BD3E00B216C2 /* Style1TableViewHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A2AB88C1BF1BD3E00B216C2 /* Style1TableViewHeaderView.m */; };
20 | 5A463BCF1BF47E5600ED5CA6 /* UITableView+VisibleSections.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A463BCE1BF47E5600ED5CA6 /* UITableView+VisibleSections.m */; };
21 | 5AF7FECB1BF324940012203B /* MGCollapsableTableViewSectionSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF7FECA1BF324940012203B /* MGCollapsableTableViewSectionSource.m */; };
22 | /* End PBXBuildFile section */
23 |
24 | /* Begin PBXFileReference section */
25 | 5A2AB8631BF197F500B216C2 /* MGCollapsableTableView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MGCollapsableTableView.app; sourceTree = BUILT_PRODUCTS_DIR; };
26 | 5A2AB8671BF197F500B216C2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = main.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
27 | 5A2AB8691BF197F500B216C2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
28 | 5A2AB86A1BF197F500B216C2 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
29 | 5A2AB86C1BF197F500B216C2 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
30 | 5A2AB86D1BF197F500B216C2 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
31 | 5A2AB8701BF197F500B216C2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
32 | 5A2AB8721BF197F500B216C2 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
33 | 5A2AB8751BF197F500B216C2 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
34 | 5A2AB8771BF197F500B216C2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
35 | 5A2AB87E1BF1983400B216C2 /* MGCollapsableTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MGCollapsableTableViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
36 | 5A2AB87F1BF1983400B216C2 /* MGCollapsableTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MGCollapsableTableViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
37 | 5A2AB8811BF1991B00B216C2 /* MGCollapsableTableViewSectionViewBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MGCollapsableTableViewSectionViewBase.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
38 | 5A2AB8861BF1B9FC00B216C2 /* Style1TableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Style1TableViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
39 | 5A2AB8871BF1B9FC00B216C2 /* Style1TableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = Style1TableViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
40 | 5A2AB8891BF1BD0E00B216C2 /* Style1TableViewHeaderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = Style1TableViewHeaderView.xib; sourceTree = ""; };
41 | 5A2AB88B1BF1BD3E00B216C2 /* Style1TableViewHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Style1TableViewHeaderView.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
42 | 5A2AB88C1BF1BD3E00B216C2 /* Style1TableViewHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = Style1TableViewHeaderView.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
43 | 5A463BCD1BF47E5600ED5CA6 /* UITableView+VisibleSections.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UITableView+VisibleSections.h"; sourceTree = ""; };
44 | 5A463BCE1BF47E5600ED5CA6 /* UITableView+VisibleSections.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UITableView+VisibleSections.m"; sourceTree = ""; };
45 | 5AF7FEC91BF324940012203B /* MGCollapsableTableViewSectionSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = MGCollapsableTableViewSectionSource.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
46 | 5AF7FECA1BF324940012203B /* MGCollapsableTableViewSectionSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = MGCollapsableTableViewSectionSource.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
47 | /* End PBXFileReference section */
48 |
49 | /* Begin PBXFrameworksBuildPhase section */
50 | 5A2AB8601BF197F500B216C2 /* Frameworks */ = {
51 | isa = PBXFrameworksBuildPhase;
52 | buildActionMask = 2147483647;
53 | files = (
54 | );
55 | runOnlyForDeploymentPostprocessing = 0;
56 | };
57 | /* End PBXFrameworksBuildPhase section */
58 |
59 | /* Begin PBXGroup section */
60 | 5A2AB85A1BF197F500B216C2 = {
61 | isa = PBXGroup;
62 | children = (
63 | 5A2AB8651BF197F500B216C2 /* MGCollapsableTableView */,
64 | 5A2AB8641BF197F500B216C2 /* Products */,
65 | );
66 | sourceTree = "";
67 | };
68 | 5A2AB8641BF197F500B216C2 /* Products */ = {
69 | isa = PBXGroup;
70 | children = (
71 | 5A2AB8631BF197F500B216C2 /* MGCollapsableTableView.app */,
72 | );
73 | name = Products;
74 | sourceTree = "";
75 | };
76 | 5A2AB8651BF197F500B216C2 /* MGCollapsableTableView */ = {
77 | isa = PBXGroup;
78 | children = (
79 | 5A2AB87D1BF1980500B216C2 /* Base */,
80 | 5A2AB8841BF19D7700B216C2 /* Style1 */,
81 | 5A2AB8691BF197F500B216C2 /* AppDelegate.h */,
82 | 5A2AB86A1BF197F500B216C2 /* AppDelegate.m */,
83 | 5A2AB86C1BF197F500B216C2 /* ViewController.h */,
84 | 5A2AB86D1BF197F500B216C2 /* ViewController.m */,
85 | 5A2AB86F1BF197F500B216C2 /* Main.storyboard */,
86 | 5A2AB8721BF197F500B216C2 /* Assets.xcassets */,
87 | 5A2AB8741BF197F500B216C2 /* LaunchScreen.storyboard */,
88 | 5A2AB8771BF197F500B216C2 /* Info.plist */,
89 | 5A2AB8661BF197F500B216C2 /* Supporting Files */,
90 | );
91 | path = MGCollapsableTableView;
92 | sourceTree = "";
93 | };
94 | 5A2AB8661BF197F500B216C2 /* Supporting Files */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 5A2AB8671BF197F500B216C2 /* main.m */,
98 | );
99 | name = "Supporting Files";
100 | sourceTree = "";
101 | };
102 | 5A2AB87D1BF1980500B216C2 /* Base */ = {
103 | isa = PBXGroup;
104 | children = (
105 | 5A2AB87E1BF1983400B216C2 /* MGCollapsableTableViewController.h */,
106 | 5A2AB87F1BF1983400B216C2 /* MGCollapsableTableViewController.m */,
107 | 5A2AB8811BF1991B00B216C2 /* MGCollapsableTableViewSectionViewBase.h */,
108 | 5AF7FEC91BF324940012203B /* MGCollapsableTableViewSectionSource.h */,
109 | 5AF7FECA1BF324940012203B /* MGCollapsableTableViewSectionSource.m */,
110 | 5A463BCD1BF47E5600ED5CA6 /* UITableView+VisibleSections.h */,
111 | 5A463BCE1BF47E5600ED5CA6 /* UITableView+VisibleSections.m */,
112 | );
113 | path = Base;
114 | sourceTree = "";
115 | };
116 | 5A2AB8841BF19D7700B216C2 /* Style1 */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 5A2AB8861BF1B9FC00B216C2 /* Style1TableViewController.h */,
120 | 5A2AB8871BF1B9FC00B216C2 /* Style1TableViewController.m */,
121 | 5A2AB8891BF1BD0E00B216C2 /* Style1TableViewHeaderView.xib */,
122 | 5A2AB88B1BF1BD3E00B216C2 /* Style1TableViewHeaderView.h */,
123 | 5A2AB88C1BF1BD3E00B216C2 /* Style1TableViewHeaderView.m */,
124 | );
125 | path = Style1;
126 | sourceTree = "";
127 | };
128 | /* End PBXGroup section */
129 |
130 | /* Begin PBXNativeTarget section */
131 | 5A2AB8621BF197F500B216C2 /* MGCollapsableTableView */ = {
132 | isa = PBXNativeTarget;
133 | buildConfigurationList = 5A2AB87A1BF197F500B216C2 /* Build configuration list for PBXNativeTarget "MGCollapsableTableView" */;
134 | buildPhases = (
135 | 5A2AB85F1BF197F500B216C2 /* Sources */,
136 | 5A2AB8601BF197F500B216C2 /* Frameworks */,
137 | 5A2AB8611BF197F500B216C2 /* Resources */,
138 | );
139 | buildRules = (
140 | );
141 | dependencies = (
142 | );
143 | name = MGCollapsableTableView;
144 | productName = MGCollapsableTableView;
145 | productReference = 5A2AB8631BF197F500B216C2 /* MGCollapsableTableView.app */;
146 | productType = "com.apple.product-type.application";
147 | };
148 | /* End PBXNativeTarget section */
149 |
150 | /* Begin PBXProject section */
151 | 5A2AB85B1BF197F500B216C2 /* Project object */ = {
152 | isa = PBXProject;
153 | attributes = {
154 | LastUpgradeCheck = 0710;
155 | ORGANIZATIONNAME = Mgen;
156 | TargetAttributes = {
157 | 5A2AB8621BF197F500B216C2 = {
158 | CreatedOnToolsVersion = 7.1;
159 | };
160 | };
161 | };
162 | buildConfigurationList = 5A2AB85E1BF197F500B216C2 /* Build configuration list for PBXProject "MGCollapsableTableView" */;
163 | compatibilityVersion = "Xcode 3.2";
164 | developmentRegion = English;
165 | hasScannedForEncodings = 0;
166 | knownRegions = (
167 | en,
168 | Base,
169 | );
170 | mainGroup = 5A2AB85A1BF197F500B216C2;
171 | productRefGroup = 5A2AB8641BF197F500B216C2 /* Products */;
172 | projectDirPath = "";
173 | projectRoot = "";
174 | targets = (
175 | 5A2AB8621BF197F500B216C2 /* MGCollapsableTableView */,
176 | );
177 | };
178 | /* End PBXProject section */
179 |
180 | /* Begin PBXResourcesBuildPhase section */
181 | 5A2AB8611BF197F500B216C2 /* Resources */ = {
182 | isa = PBXResourcesBuildPhase;
183 | buildActionMask = 2147483647;
184 | files = (
185 | 5A2AB8761BF197F500B216C2 /* LaunchScreen.storyboard in Resources */,
186 | 5A2AB8731BF197F500B216C2 /* Assets.xcassets in Resources */,
187 | 5A2AB8711BF197F500B216C2 /* Main.storyboard in Resources */,
188 | 5A2AB88A1BF1BD0E00B216C2 /* Style1TableViewHeaderView.xib in Resources */,
189 | );
190 | runOnlyForDeploymentPostprocessing = 0;
191 | };
192 | /* End PBXResourcesBuildPhase section */
193 |
194 | /* Begin PBXSourcesBuildPhase section */
195 | 5A2AB85F1BF197F500B216C2 /* Sources */ = {
196 | isa = PBXSourcesBuildPhase;
197 | buildActionMask = 2147483647;
198 | files = (
199 | 5A2AB86E1BF197F500B216C2 /* ViewController.m in Sources */,
200 | 5A2AB86B1BF197F500B216C2 /* AppDelegate.m in Sources */,
201 | 5A2AB8881BF1B9FC00B216C2 /* Style1TableViewController.m in Sources */,
202 | 5AF7FECB1BF324940012203B /* MGCollapsableTableViewSectionSource.m in Sources */,
203 | 5A2AB8801BF1983400B216C2 /* MGCollapsableTableViewController.m in Sources */,
204 | 5A463BCF1BF47E5600ED5CA6 /* UITableView+VisibleSections.m in Sources */,
205 | 5A2AB8681BF197F500B216C2 /* main.m in Sources */,
206 | 5A2AB88D1BF1BD3E00B216C2 /* Style1TableViewHeaderView.m in Sources */,
207 | );
208 | runOnlyForDeploymentPostprocessing = 0;
209 | };
210 | /* End PBXSourcesBuildPhase section */
211 |
212 | /* Begin PBXVariantGroup section */
213 | 5A2AB86F1BF197F500B216C2 /* Main.storyboard */ = {
214 | isa = PBXVariantGroup;
215 | children = (
216 | 5A2AB8701BF197F500B216C2 /* Base */,
217 | );
218 | name = Main.storyboard;
219 | sourceTree = "";
220 | };
221 | 5A2AB8741BF197F500B216C2 /* LaunchScreen.storyboard */ = {
222 | isa = PBXVariantGroup;
223 | children = (
224 | 5A2AB8751BF197F500B216C2 /* Base */,
225 | );
226 | name = LaunchScreen.storyboard;
227 | sourceTree = "";
228 | };
229 | /* End PBXVariantGroup section */
230 |
231 | /* Begin XCBuildConfiguration section */
232 | 5A2AB8781BF197F500B216C2 /* Debug */ = {
233 | isa = XCBuildConfiguration;
234 | buildSettings = {
235 | ALWAYS_SEARCH_USER_PATHS = NO;
236 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
237 | CLANG_CXX_LIBRARY = "libc++";
238 | CLANG_ENABLE_MODULES = YES;
239 | CLANG_ENABLE_OBJC_ARC = YES;
240 | CLANG_WARN_BOOL_CONVERSION = YES;
241 | CLANG_WARN_CONSTANT_CONVERSION = YES;
242 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
243 | CLANG_WARN_EMPTY_BODY = YES;
244 | CLANG_WARN_ENUM_CONVERSION = YES;
245 | CLANG_WARN_INT_CONVERSION = YES;
246 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
247 | CLANG_WARN_UNREACHABLE_CODE = YES;
248 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
249 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
250 | COPY_PHASE_STRIP = NO;
251 | DEBUG_INFORMATION_FORMAT = dwarf;
252 | ENABLE_STRICT_OBJC_MSGSEND = YES;
253 | ENABLE_TESTABILITY = YES;
254 | GCC_C_LANGUAGE_STANDARD = gnu99;
255 | GCC_DYNAMIC_NO_PIC = NO;
256 | GCC_NO_COMMON_BLOCKS = YES;
257 | GCC_OPTIMIZATION_LEVEL = 0;
258 | GCC_PREPROCESSOR_DEFINITIONS = (
259 | "DEBUG=1",
260 | "$(inherited)",
261 | );
262 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
263 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
264 | GCC_WARN_UNDECLARED_SELECTOR = YES;
265 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
266 | GCC_WARN_UNUSED_FUNCTION = YES;
267 | GCC_WARN_UNUSED_VARIABLE = YES;
268 | IPHONEOS_DEPLOYMENT_TARGET = 9.1;
269 | MTL_ENABLE_DEBUG_INFO = YES;
270 | ONLY_ACTIVE_ARCH = YES;
271 | SDKROOT = iphoneos;
272 | };
273 | name = Debug;
274 | };
275 | 5A2AB8791BF197F500B216C2 /* Release */ = {
276 | isa = XCBuildConfiguration;
277 | buildSettings = {
278 | ALWAYS_SEARCH_USER_PATHS = NO;
279 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
280 | CLANG_CXX_LIBRARY = "libc++";
281 | CLANG_ENABLE_MODULES = YES;
282 | CLANG_ENABLE_OBJC_ARC = YES;
283 | CLANG_WARN_BOOL_CONVERSION = YES;
284 | CLANG_WARN_CONSTANT_CONVERSION = YES;
285 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
286 | CLANG_WARN_EMPTY_BODY = YES;
287 | CLANG_WARN_ENUM_CONVERSION = YES;
288 | CLANG_WARN_INT_CONVERSION = YES;
289 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
290 | CLANG_WARN_UNREACHABLE_CODE = YES;
291 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
292 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
293 | COPY_PHASE_STRIP = NO;
294 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
295 | ENABLE_NS_ASSERTIONS = NO;
296 | ENABLE_STRICT_OBJC_MSGSEND = YES;
297 | GCC_C_LANGUAGE_STANDARD = gnu99;
298 | GCC_NO_COMMON_BLOCKS = YES;
299 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
300 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
301 | GCC_WARN_UNDECLARED_SELECTOR = YES;
302 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
303 | GCC_WARN_UNUSED_FUNCTION = YES;
304 | GCC_WARN_UNUSED_VARIABLE = YES;
305 | IPHONEOS_DEPLOYMENT_TARGET = 9.1;
306 | MTL_ENABLE_DEBUG_INFO = NO;
307 | SDKROOT = iphoneos;
308 | VALIDATE_PRODUCT = YES;
309 | };
310 | name = Release;
311 | };
312 | 5A2AB87B1BF197F500B216C2 /* Debug */ = {
313 | isa = XCBuildConfiguration;
314 | buildSettings = {
315 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
316 | INFOPLIST_FILE = MGCollapsableTableView/Info.plist;
317 | IPHONEOS_DEPLOYMENT_TARGET = 6.0;
318 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
319 | PRODUCT_BUNDLE_IDENTIFIER = Mgen.MGCollapsableTableView;
320 | PRODUCT_NAME = "$(TARGET_NAME)";
321 | };
322 | name = Debug;
323 | };
324 | 5A2AB87C1BF197F500B216C2 /* Release */ = {
325 | isa = XCBuildConfiguration;
326 | buildSettings = {
327 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
328 | INFOPLIST_FILE = MGCollapsableTableView/Info.plist;
329 | IPHONEOS_DEPLOYMENT_TARGET = 6.0;
330 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
331 | PRODUCT_BUNDLE_IDENTIFIER = Mgen.MGCollapsableTableView;
332 | PRODUCT_NAME = "$(TARGET_NAME)";
333 | };
334 | name = Release;
335 | };
336 | /* End XCBuildConfiguration section */
337 |
338 | /* Begin XCConfigurationList section */
339 | 5A2AB85E1BF197F500B216C2 /* Build configuration list for PBXProject "MGCollapsableTableView" */ = {
340 | isa = XCConfigurationList;
341 | buildConfigurations = (
342 | 5A2AB8781BF197F500B216C2 /* Debug */,
343 | 5A2AB8791BF197F500B216C2 /* Release */,
344 | );
345 | defaultConfigurationIsVisible = 0;
346 | defaultConfigurationName = Release;
347 | };
348 | 5A2AB87A1BF197F500B216C2 /* Build configuration list for PBXNativeTarget "MGCollapsableTableView" */ = {
349 | isa = XCConfigurationList;
350 | buildConfigurations = (
351 | 5A2AB87B1BF197F500B216C2 /* Debug */,
352 | 5A2AB87C1BF197F500B216C2 /* Release */,
353 | );
354 | defaultConfigurationIsVisible = 0;
355 | defaultConfigurationName = Release;
356 | };
357 | /* End XCConfigurationList section */
358 | };
359 | rootObject = 5A2AB85B1BF197F500B216C2 /* Project object */;
360 | }
361 |
--------------------------------------------------------------------------------