Add indexed list example

This commit is contained in:
Roman Efimov
2013-08-14 10:02:55 -05:00
parent d367590a2b
commit 6e7e2d4b7e
4 changed files with 70 additions and 0 deletions

View File

@@ -61,6 +61,7 @@
30DB067916E934AD006C9530 /* RETableViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DB066716E934AD006C9530 /* RETableViewManager.m */; };
30DB067A16E934AD006C9530 /* RETableViewSection.m in Sources */ = {isa = PBXBuildFile; fileRef = 30DB066916E934AD006C9530 /* RETableViewSection.m */; };
30E16A48171A103400F7C258 /* EditingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E16A47171A103300F7C258 /* EditingViewController.m */; };
30E5F50C17BBD163005CF1FE /* IndexedListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 30E5F50B17BBD163005CF1FE /* IndexedListViewController.m */; };
30EF93B316E039B800B84981 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30EF93B216E039B800B84981 /* UIKit.framework */; };
30EF93B516E039B800B84981 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30EF93B416E039B800B84981 /* Foundation.framework */; };
30EF93B716E039B800B84981 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30EF93B616E039B800B84981 /* CoreGraphics.framework */; };
@@ -173,6 +174,8 @@
30DB066916E934AD006C9530 /* RETableViewSection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RETableViewSection.m; sourceTree = "<group>"; };
30E16A46171A103300F7C258 /* EditingViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingViewController.h; sourceTree = "<group>"; };
30E16A47171A103300F7C258 /* EditingViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EditingViewController.m; sourceTree = "<group>"; };
30E5F50A17BBD163005CF1FE /* IndexedListViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndexedListViewController.h; sourceTree = "<group>"; };
30E5F50B17BBD163005CF1FE /* IndexedListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IndexedListViewController.m; sourceTree = "<group>"; };
30EF93AF16E039B800B84981 /* RETableViewManagerExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RETableViewManagerExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
30EF93B216E039B800B84981 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
30EF93B416E039B800B84981 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
@@ -245,6 +248,8 @@
30FE4146176A306600F317B8 /* StylingViewController.m */,
303D967017B7CDE300A418F3 /* XIBTestViewController.h */,
303D967117B7CDE300A418F3 /* XIBTestViewController.m */,
30E5F50A17BBD163005CF1FE /* IndexedListViewController.h */,
30E5F50B17BBD163005CF1FE /* IndexedListViewController.m */,
);
path = Controllers;
sourceTree = "<group>";
@@ -587,6 +592,7 @@
303D966817B7CCE300A418F3 /* XIBTestItem.m in Sources */,
303D966B17B7CCF800A418F3 /* XIBTestCell.m in Sources */,
303D967217B7CDE300A418F3 /* XIBTestViewController.m in Sources */,
30E5F50C17BBD163005CF1FE /* IndexedListViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@@ -0,0 +1,16 @@
//
// IndexedListViewController.h
// RETableViewManagerExample
//
// Created by Roman Efimov on 8/14/13.
// Copyright (c) 2013 Roman Efimov. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "RETableViewManager.h"
@interface IndexedListViewController : UITableViewController
@property (strong, readwrite, nonatomic) RETableViewManager *manager;
@end

View File

@@ -0,0 +1,42 @@
//
// IndexedListViewController.m
// RETableViewManagerExample
//
// Created by Roman Efimov on 8/14/13.
// Copyright (c) 2013 Roman Efimov. All rights reserved.
//
#import "IndexedListViewController.h"
@interface IndexedListViewController ()
@end
@implementation IndexedListViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = @"Indexed List";
// Create manager
//
self.manager = [[RETableViewManager alloc] initWithTableView:self.tableView];
NSArray *sectionTitles = @[@"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", @"M",
@"N", @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z"];
// Add sections and items
//
for (NSString *sectionTitle in sectionTitles) {
RETableViewSection *section = [RETableViewSection sectionWithHeaderTitle:sectionTitle];
section.indexTitle = sectionTitle; // assign index title
for (NSInteger i = 1; i <= 5; i++)
[section addItem:[NSString stringWithFormat:@"%@%i", sectionTitle, i]];
[self.manager addSection:section];
}
}
@end

View File

@@ -13,6 +13,7 @@
#import "RetractableViewController.h"
#import "StylingViewController.h"
#import "XIBTestViewController.h"
#import "IndexedListViewController.h"
@interface RootViewController ()
@@ -65,6 +66,11 @@
[item deselectRowAnimated:YES];
[weakSelf.navigationController pushViewController:[[XIBTestViewController alloc] initWithStyle:UITableViewStyleGrouped] animated:YES];
}]];
[section addItem:[RETableViewItem itemWithTitle:@"Indexed List" accessoryType:UITableViewCellAccessoryDisclosureIndicator selectionHandler:^(RETableViewItem *item) {
[item deselectRowAnimated:YES];
[weakSelf.navigationController pushViewController:[[IndexedListViewController alloc] initWithStyle:UITableViewStylePlain] animated:YES];
}]];
}
@end