Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

#import <UIKit/UIKit.h>

@interface GCRetractableSectionController : NSObject
@interface GCRetractableSectionController : NSObject {
NSUInteger activeSection;
}

@property (nonatomic, assign, getter = isOpen) BOOL open;

Expand Down Expand Up @@ -38,6 +40,7 @@
- (void) didSelectCellAtRow:(NSUInteger) row;
- (void) didSelectTitleCell;
- (void) didSelectContentCellAtRow:(NSUInteger) row;
- (void) didSelectCellAtRow:(NSUInteger)row inSection:(NSUInteger)section;

//Reserved for subclasses
@property (nonatomic, readonly) UIViewController *viewController;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,20 @@ - (void) didSelectCellAtRow:(NSUInteger)row {
else [self didSelectContentCellAtRow:row - 1];
}

- (void) didSelectCellAtRow:(NSUInteger)row inSection:(NSUInteger)section {
activeSection = section;
[self didSelectCellAtRow:row];
}

- (void) didSelectTitleCell {
self.open = !self.open;
if (self.contentNumberOfRow != 0) [self setAccessoryViewOnCell:[self.tableView cellForRowAtIndexPath:[self.tableView indexPathForSelectedRow]]];

NSIndexPath* indexPath = [self.tableView indexPathForSelectedRow];
NSUInteger section = indexPath.section;
if (indexPath == nil) {
section = activeSection;
}
NSUInteger contentCount = self.contentNumberOfRow;

[self.tableView beginUpdates];
Expand Down