├── AIMTableViewIndexBar.podspec ├── AIMTableViewIndexBar ├── AIMTableViewIndexBar.h └── AIMTableViewIndexBar.m ├── AIMTableViewIndexBarExample.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── marekkotewicz.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── marekkotewicz.xcuserdatad │ └── xcschemes │ ├── AIMTableViewIndexBarExample.xcscheme │ └── xcschememanagement.plist ├── AIMTableViewIndexBarExample ├── AIMTableViewIndexBarExample-Info.plist ├── AIMTableViewIndexBarExample-Prefix.pch ├── AppDelegate.h ├── AppDelegate.m ├── Default-568h@2x.png ├── Default.png ├── Default@2x.png ├── ExampleViewController.h ├── ExampleViewController.m ├── ExampleViewController.xib ├── en.lproj │ └── InfoPlist.strings └── main.m ├── LICENSE └── README.md /AIMTableViewIndexBar.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'AIMTableViewIndexBar' 3 | s.version = '0.1.1' 4 | s.license = 'MIT' 5 | s.author = {'Marek Kotewicz' => 'https://github.com/debris' } 6 | s.homepage = 'https://github.com/debris/AIMTableViewIndexBar' 7 | s.summary = 'Custom index bar for UITableView' 8 | s.screenshot = 'https://s3.amazonaws.com/cocoacontrols_production/uploads/control_image/image/1802/IMG_0070.PNG' 9 | 10 | s.source = { :git => 'https://github.com/debris/AIMTableViewIndexBar.git', :tag => '0.1.1'} 11 | s.source_files = 'AIMTableViewIndexBar', 'AIMTableViewIndexBar/../*.{h/m}' 12 | s.framework = 'Foundation' 13 | s.requires_arc = true 14 | s.platform = :ios 15 | s.ios.deployment_target = '6.0' 16 | 17 | end 18 | -------------------------------------------------------------------------------- /AIMTableViewIndexBar/AIMTableViewIndexBar.h: -------------------------------------------------------------------------------- 1 | // 2 | // AIMTableViewIndexBar.h 3 | // AIMTableViewIndexBar 4 | // 5 | // Created by Marek Kotewicz on 07.09.2013. 6 | // Copyright (c) 2013 AllInMobile. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import 28 | 29 | @class AIMTableViewIndexBar; 30 | 31 | @protocol AIMTableViewIndexBarDelegate 32 | 33 | - (void)tableViewIndexBar:(AIMTableViewIndexBar*)indexBar didSelectSectionAtIndex:(NSInteger)index; 34 | 35 | @end 36 | 37 | @interface AIMTableViewIndexBar : UIView 38 | 39 | @property (nonatomic, strong) NSArray *indexes; 40 | @property (nonatomic, weak) id delegate; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /AIMTableViewIndexBar/AIMTableViewIndexBar.m: -------------------------------------------------------------------------------- 1 | // 2 | // AIMTableViewIndexBar.m 3 | // AIMTableViewIndexBar 4 | // 5 | // Created by Marek Kotewicz on 07.09.2013. 6 | // Copyright (c) 2013 AllInMobile. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import 28 | #import "AIMTableViewIndexBar.h" 29 | 30 | #if !__has_feature(objc_arc) 31 | #error AIMTableViewIndexBar must be built with ARC. 32 | // You can turn on ARC for only AIMTableViewIndexBar files by adding -fobjc-arc to the build phase for each of its files. 33 | #endif 34 | 35 | #define RGB(r,g,b,a) [UIColor colorWithRed:(double)r/255.0f green:(double)g/255.0f blue:(double)b/255.0f alpha:a] 36 | 37 | @interface AIMTableViewIndexBar (){ 38 | BOOL isLayedOut; 39 | NSArray *letters; 40 | CAShapeLayer *shapeLayer; 41 | CGFloat letterHeight; 42 | } 43 | 44 | @end 45 | 46 | 47 | @implementation AIMTableViewIndexBar 48 | @synthesize indexes, delegate; 49 | 50 | - (id)init{ 51 | if (self = [super init]){ 52 | [self setup]; 53 | } 54 | return self; 55 | } 56 | 57 | - (id)initWithFrame:(CGRect)frame{ 58 | if (self = [super initWithFrame:frame]) { 59 | [self setup]; 60 | } 61 | return self; 62 | } 63 | 64 | - (id)initWithCoder:(NSCoder *)aDecoder{ 65 | if (self = [super initWithCoder:aDecoder]){ 66 | [self setup]; 67 | } 68 | return self; 69 | } 70 | 71 | - (void)setup{ 72 | letters = @[@"#", @"A", @"B", @"C", 73 | @"D", @"E", @"F", @"G", 74 | @"H", @"I", @"J", @"K", 75 | @"L", @"M", @"N", @"O", 76 | @"P", @"Q", @"R", @"S", 77 | @"T", @"U", @"V", @"W", 78 | @"X", @"Y", @"Z"]; 79 | 80 | shapeLayer = [CAShapeLayer layer]; 81 | shapeLayer.lineWidth = 1.0f; 82 | shapeLayer.fillColor = [UIColor clearColor].CGColor; 83 | shapeLayer.lineJoin = kCALineCapSquare; 84 | shapeLayer.strokeColor = [RGB(218, 218, 218, 1) CGColor]; 85 | shapeLayer.strokeEnd = 1.0f; 86 | self.layer.masksToBounds = NO; 87 | } 88 | 89 | - (void)setIndexes:(NSArray *)idxs{ 90 | indexes = idxs; 91 | isLayedOut = NO; 92 | [self layoutSubviews]; 93 | } 94 | 95 | - (void)layoutSubviews{ 96 | [super layoutSubviews]; 97 | 98 | 99 | if (!isLayedOut){ 100 | 101 | [self.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)]; 102 | 103 | shapeLayer.frame = (CGRect) {.origin = CGPointZero, .size = self.layer.frame.size}; 104 | UIBezierPath *bezierPath = [UIBezierPath bezierPath]; 105 | [bezierPath moveToPoint:CGPointZero]; 106 | [bezierPath addLineToPoint:CGPointMake(0, self.frame.size.height)]; 107 | letterHeight = self.frame.size.height / [letters count]; 108 | CGFloat fontSize = 12; 109 | if (letterHeight < 14){ 110 | fontSize = 11; 111 | } 112 | 113 | [letters enumerateObjectsUsingBlock:^(NSString *letter, NSUInteger idx, BOOL *stop) { 114 | CGFloat originY = idx * letterHeight; 115 | CATextLayer *ctl = [self textLayerWithSize:fontSize 116 | string:letter 117 | andFrame:CGRectMake(0, originY, self.frame.size.width, letterHeight)]; 118 | [self.layer addSublayer:ctl]; 119 | [bezierPath moveToPoint:CGPointMake(0, originY)]; 120 | [bezierPath addLineToPoint:CGPointMake(ctl.frame.size.width, originY)]; 121 | }]; 122 | 123 | shapeLayer.path = bezierPath.CGPath; 124 | [self.layer addSublayer:shapeLayer]; 125 | 126 | isLayedOut = YES; 127 | } 128 | } 129 | 130 | - (CATextLayer*)textLayerWithSize:(CGFloat)size string:(NSString*)string andFrame:(CGRect)frame{ 131 | CATextLayer *tl = [CATextLayer layer]; 132 | [tl setFont:@"ArialMT"]; 133 | [tl setFontSize:size]; 134 | [tl setFrame:frame]; 135 | [tl setAlignmentMode:kCAAlignmentCenter]; 136 | [tl setContentsScale:[[UIScreen mainScreen] scale]]; 137 | [tl setForegroundColor:RGB(168, 168, 168, 1).CGColor]; 138 | [tl setString:string]; 139 | return tl; 140 | } 141 | 142 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ 143 | [super touchesBegan:touches withEvent:event]; 144 | [self sendEventToDelegate:event]; 145 | } 146 | 147 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{ 148 | [super touchesMoved:touches withEvent:event]; 149 | [self sendEventToDelegate:event]; 150 | } 151 | 152 | - (void)sendEventToDelegate:(UIEvent*)event{ 153 | UITouch *touch = [[event allTouches] anyObject]; 154 | CGPoint point = [touch locationInView:self]; 155 | NSInteger indx = (NSInteger) floorf(fabs(point.y) / letterHeight); 156 | indx = indx < [letters count] ? indx : [letters count] - 1; 157 | 158 | [self animateLayerAtIndex:indx]; 159 | 160 | __block NSInteger scrollIndex; 161 | NSIndexSet *indexSet = [[NSIndexSet alloc] initWithIndexesInRange:NSMakeRange(0, indx+1)]; 162 | [letters enumerateObjectsAtIndexes:indexSet options:NSEnumerationReverse usingBlock:^(NSString *letter, NSUInteger idx, BOOL *stop) { 163 | scrollIndex = [indexes indexOfObject:letter]; 164 | *stop = scrollIndex != NSNotFound; 165 | }]; 166 | 167 | [delegate tableViewIndexBar:self didSelectSectionAtIndex:scrollIndex]; 168 | } 169 | 170 | - (void)animateLayerAtIndex:(NSInteger)index{ 171 | if ([self.layer.sublayers count] - 1 > index){ 172 | CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"backgroundColor"]; 173 | animation.toValue = (id)[RGB(180, 180, 180, 1) CGColor]; 174 | animation.duration = 0.5f; 175 | animation.autoreverses = YES; 176 | animation.repeatCount = 1; 177 | animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; 178 | [self.layer.sublayers[index] addAnimation:animation forKey:@"myAnimation"]; 179 | } 180 | } 181 | 182 | 183 | @end 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 93937C6117DB015300AB6F66 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93937C6017DB015300AB6F66 /* UIKit.framework */; }; 11 | 93937C6317DB015300AB6F66 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93937C6217DB015300AB6F66 /* Foundation.framework */; }; 12 | 93937C6517DB015300AB6F66 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93937C6417DB015300AB6F66 /* CoreGraphics.framework */; }; 13 | 93937C6B17DB015300AB6F66 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 93937C6917DB015300AB6F66 /* InfoPlist.strings */; }; 14 | 93937C6D17DB015300AB6F66 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 93937C6C17DB015300AB6F66 /* main.m */; }; 15 | 93937C7117DB015300AB6F66 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 93937C7017DB015300AB6F66 /* AppDelegate.m */; }; 16 | 93937C7317DB015300AB6F66 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 93937C7217DB015300AB6F66 /* Default.png */; }; 17 | 93937C7517DB015300AB6F66 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93937C7417DB015300AB6F66 /* Default@2x.png */; }; 18 | 93937C7717DB015300AB6F66 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 93937C7617DB015300AB6F66 /* Default-568h@2x.png */; }; 19 | 93937C7E17DB015F00AB6F66 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 93937C7D17DB015F00AB6F66 /* QuartzCore.framework */; }; 20 | 93937C8217DB01D100AB6F66 /* ExampleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93937C8017DB01D100AB6F66 /* ExampleViewController.m */; }; 21 | 93937C8317DB01D100AB6F66 /* ExampleViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93937C8117DB01D100AB6F66 /* ExampleViewController.xib */; }; 22 | 93937C8717DB02B800AB6F66 /* AIMTableViewIndexBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 93937C8617DB02B800AB6F66 /* AIMTableViewIndexBar.m */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 93937C5D17DB015300AB6F66 /* AIMTableViewIndexBarExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AIMTableViewIndexBarExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 93937C6017DB015300AB6F66 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 28 | 93937C6217DB015300AB6F66 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 29 | 93937C6417DB015300AB6F66 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 30 | 93937C6817DB015300AB6F66 /* AIMTableViewIndexBarExample-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "AIMTableViewIndexBarExample-Info.plist"; sourceTree = ""; }; 31 | 93937C6A17DB015300AB6F66 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 32 | 93937C6C17DB015300AB6F66 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 33 | 93937C6E17DB015300AB6F66 /* AIMTableViewIndexBarExample-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AIMTableViewIndexBarExample-Prefix.pch"; sourceTree = ""; }; 34 | 93937C6F17DB015300AB6F66 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | 93937C7017DB015300AB6F66 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | 93937C7217DB015300AB6F66 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = ""; }; 37 | 93937C7417DB015300AB6F66 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = ""; }; 38 | 93937C7617DB015300AB6F66 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = ""; }; 39 | 93937C7D17DB015F00AB6F66 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 40 | 93937C7F17DB01D100AB6F66 /* ExampleViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExampleViewController.h; sourceTree = ""; }; 41 | 93937C8017DB01D100AB6F66 /* ExampleViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExampleViewController.m; sourceTree = ""; }; 42 | 93937C8117DB01D100AB6F66 /* ExampleViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ExampleViewController.xib; sourceTree = ""; }; 43 | 93937C8517DB02B800AB6F66 /* AIMTableViewIndexBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AIMTableViewIndexBar.h; sourceTree = ""; }; 44 | 93937C8617DB02B800AB6F66 /* AIMTableViewIndexBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AIMTableViewIndexBar.m; sourceTree = ""; }; 45 | /* End PBXFileReference section */ 46 | 47 | /* Begin PBXFrameworksBuildPhase section */ 48 | 93937C5A17DB015300AB6F66 /* Frameworks */ = { 49 | isa = PBXFrameworksBuildPhase; 50 | buildActionMask = 2147483647; 51 | files = ( 52 | 93937C7E17DB015F00AB6F66 /* QuartzCore.framework in Frameworks */, 53 | 93937C6117DB015300AB6F66 /* UIKit.framework in Frameworks */, 54 | 93937C6317DB015300AB6F66 /* Foundation.framework in Frameworks */, 55 | 93937C6517DB015300AB6F66 /* CoreGraphics.framework in Frameworks */, 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | 93937C5417DB015300AB6F66 = { 63 | isa = PBXGroup; 64 | children = ( 65 | 93937C8417DB027000AB6F66 /* AIMTableViewIndexBar */, 66 | 93937C6617DB015300AB6F66 /* AIMTableViewIndexBarExample */, 67 | 93937C5F17DB015300AB6F66 /* Frameworks */, 68 | 93937C5E17DB015300AB6F66 /* Products */, 69 | ); 70 | sourceTree = ""; 71 | }; 72 | 93937C5E17DB015300AB6F66 /* Products */ = { 73 | isa = PBXGroup; 74 | children = ( 75 | 93937C5D17DB015300AB6F66 /* AIMTableViewIndexBarExample.app */, 76 | ); 77 | name = Products; 78 | sourceTree = ""; 79 | }; 80 | 93937C5F17DB015300AB6F66 /* Frameworks */ = { 81 | isa = PBXGroup; 82 | children = ( 83 | 93937C6017DB015300AB6F66 /* UIKit.framework */, 84 | 93937C6217DB015300AB6F66 /* Foundation.framework */, 85 | 93937C6417DB015300AB6F66 /* CoreGraphics.framework */, 86 | 93937C7D17DB015F00AB6F66 /* QuartzCore.framework */, 87 | ); 88 | name = Frameworks; 89 | sourceTree = ""; 90 | }; 91 | 93937C6617DB015300AB6F66 /* AIMTableViewIndexBarExample */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 93937C6F17DB015300AB6F66 /* AppDelegate.h */, 95 | 93937C7017DB015300AB6F66 /* AppDelegate.m */, 96 | 93937C7F17DB01D100AB6F66 /* ExampleViewController.h */, 97 | 93937C8017DB01D100AB6F66 /* ExampleViewController.m */, 98 | 93937C8117DB01D100AB6F66 /* ExampleViewController.xib */, 99 | 93937C6717DB015300AB6F66 /* Supporting Files */, 100 | ); 101 | path = AIMTableViewIndexBarExample; 102 | sourceTree = ""; 103 | }; 104 | 93937C6717DB015300AB6F66 /* Supporting Files */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 93937C6817DB015300AB6F66 /* AIMTableViewIndexBarExample-Info.plist */, 108 | 93937C6917DB015300AB6F66 /* InfoPlist.strings */, 109 | 93937C6C17DB015300AB6F66 /* main.m */, 110 | 93937C6E17DB015300AB6F66 /* AIMTableViewIndexBarExample-Prefix.pch */, 111 | 93937C7217DB015300AB6F66 /* Default.png */, 112 | 93937C7417DB015300AB6F66 /* Default@2x.png */, 113 | 93937C7617DB015300AB6F66 /* Default-568h@2x.png */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | 93937C8417DB027000AB6F66 /* AIMTableViewIndexBar */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 93937C8517DB02B800AB6F66 /* AIMTableViewIndexBar.h */, 122 | 93937C8617DB02B800AB6F66 /* AIMTableViewIndexBar.m */, 123 | ); 124 | path = AIMTableViewIndexBar; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | 93937C5C17DB015300AB6F66 /* AIMTableViewIndexBarExample */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = 93937C7A17DB015300AB6F66 /* Build configuration list for PBXNativeTarget "AIMTableViewIndexBarExample" */; 133 | buildPhases = ( 134 | 93937C5917DB015300AB6F66 /* Sources */, 135 | 93937C5A17DB015300AB6F66 /* Frameworks */, 136 | 93937C5B17DB015300AB6F66 /* Resources */, 137 | ); 138 | buildRules = ( 139 | ); 140 | dependencies = ( 141 | ); 142 | name = AIMTableViewIndexBarExample; 143 | productName = AIMTableViewIndexBarExample; 144 | productReference = 93937C5D17DB015300AB6F66 /* AIMTableViewIndexBarExample.app */; 145 | productType = "com.apple.product-type.application"; 146 | }; 147 | /* End PBXNativeTarget section */ 148 | 149 | /* Begin PBXProject section */ 150 | 93937C5517DB015300AB6F66 /* Project object */ = { 151 | isa = PBXProject; 152 | attributes = { 153 | LastUpgradeCheck = 0460; 154 | ORGANIZATIONNAME = AllInMobile; 155 | }; 156 | buildConfigurationList = 93937C5817DB015300AB6F66 /* Build configuration list for PBXProject "AIMTableViewIndexBarExample" */; 157 | compatibilityVersion = "Xcode 3.2"; 158 | developmentRegion = English; 159 | hasScannedForEncodings = 0; 160 | knownRegions = ( 161 | en, 162 | ); 163 | mainGroup = 93937C5417DB015300AB6F66; 164 | productRefGroup = 93937C5E17DB015300AB6F66 /* Products */; 165 | projectDirPath = ""; 166 | projectRoot = ""; 167 | targets = ( 168 | 93937C5C17DB015300AB6F66 /* AIMTableViewIndexBarExample */, 169 | ); 170 | }; 171 | /* End PBXProject section */ 172 | 173 | /* Begin PBXResourcesBuildPhase section */ 174 | 93937C5B17DB015300AB6F66 /* Resources */ = { 175 | isa = PBXResourcesBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | 93937C6B17DB015300AB6F66 /* InfoPlist.strings in Resources */, 179 | 93937C7317DB015300AB6F66 /* Default.png in Resources */, 180 | 93937C7517DB015300AB6F66 /* Default@2x.png in Resources */, 181 | 93937C7717DB015300AB6F66 /* Default-568h@2x.png in Resources */, 182 | 93937C8317DB01D100AB6F66 /* ExampleViewController.xib in Resources */, 183 | ); 184 | runOnlyForDeploymentPostprocessing = 0; 185 | }; 186 | /* End PBXResourcesBuildPhase section */ 187 | 188 | /* Begin PBXSourcesBuildPhase section */ 189 | 93937C5917DB015300AB6F66 /* Sources */ = { 190 | isa = PBXSourcesBuildPhase; 191 | buildActionMask = 2147483647; 192 | files = ( 193 | 93937C6D17DB015300AB6F66 /* main.m in Sources */, 194 | 93937C7117DB015300AB6F66 /* AppDelegate.m in Sources */, 195 | 93937C8217DB01D100AB6F66 /* ExampleViewController.m in Sources */, 196 | 93937C8717DB02B800AB6F66 /* AIMTableViewIndexBar.m in Sources */, 197 | ); 198 | runOnlyForDeploymentPostprocessing = 0; 199 | }; 200 | /* End PBXSourcesBuildPhase section */ 201 | 202 | /* Begin PBXVariantGroup section */ 203 | 93937C6917DB015300AB6F66 /* InfoPlist.strings */ = { 204 | isa = PBXVariantGroup; 205 | children = ( 206 | 93937C6A17DB015300AB6F66 /* en */, 207 | ); 208 | name = InfoPlist.strings; 209 | sourceTree = ""; 210 | }; 211 | /* End PBXVariantGroup section */ 212 | 213 | /* Begin XCBuildConfiguration section */ 214 | 93937C7817DB015300AB6F66 /* Debug */ = { 215 | isa = XCBuildConfiguration; 216 | buildSettings = { 217 | ALWAYS_SEARCH_USER_PATHS = NO; 218 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 219 | CLANG_CXX_LIBRARY = "libc++"; 220 | CLANG_ENABLE_OBJC_ARC = YES; 221 | CLANG_WARN_CONSTANT_CONVERSION = YES; 222 | CLANG_WARN_EMPTY_BODY = YES; 223 | CLANG_WARN_ENUM_CONVERSION = YES; 224 | CLANG_WARN_INT_CONVERSION = YES; 225 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 226 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 227 | COPY_PHASE_STRIP = NO; 228 | GCC_C_LANGUAGE_STANDARD = gnu99; 229 | GCC_DYNAMIC_NO_PIC = NO; 230 | GCC_OPTIMIZATION_LEVEL = 0; 231 | GCC_PREPROCESSOR_DEFINITIONS = ( 232 | "DEBUG=1", 233 | "$(inherited)", 234 | ); 235 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 236 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 237 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 240 | ONLY_ACTIVE_ARCH = YES; 241 | SDKROOT = iphoneos; 242 | TARGETED_DEVICE_FAMILY = "1,2"; 243 | }; 244 | name = Debug; 245 | }; 246 | 93937C7917DB015300AB6F66 /* Release */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | ALWAYS_SEARCH_USER_PATHS = NO; 250 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 251 | CLANG_CXX_LIBRARY = "libc++"; 252 | CLANG_ENABLE_OBJC_ARC = YES; 253 | CLANG_WARN_CONSTANT_CONVERSION = YES; 254 | CLANG_WARN_EMPTY_BODY = YES; 255 | CLANG_WARN_ENUM_CONVERSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 258 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 259 | COPY_PHASE_STRIP = YES; 260 | GCC_C_LANGUAGE_STANDARD = gnu99; 261 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 262 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 263 | GCC_WARN_UNUSED_VARIABLE = YES; 264 | IPHONEOS_DEPLOYMENT_TARGET = 6.1; 265 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; 266 | SDKROOT = iphoneos; 267 | TARGETED_DEVICE_FAMILY = "1,2"; 268 | VALIDATE_PRODUCT = YES; 269 | }; 270 | name = Release; 271 | }; 272 | 93937C7B17DB015300AB6F66 /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 276 | GCC_PREFIX_HEADER = "AIMTableViewIndexBarExample/AIMTableViewIndexBarExample-Prefix.pch"; 277 | INFOPLIST_FILE = "AIMTableViewIndexBarExample/AIMTableViewIndexBarExample-Info.plist"; 278 | PRODUCT_NAME = "$(TARGET_NAME)"; 279 | WRAPPER_EXTENSION = app; 280 | }; 281 | name = Debug; 282 | }; 283 | 93937C7C17DB015300AB6F66 /* Release */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 287 | GCC_PREFIX_HEADER = "AIMTableViewIndexBarExample/AIMTableViewIndexBarExample-Prefix.pch"; 288 | INFOPLIST_FILE = "AIMTableViewIndexBarExample/AIMTableViewIndexBarExample-Info.plist"; 289 | PRODUCT_NAME = "$(TARGET_NAME)"; 290 | WRAPPER_EXTENSION = app; 291 | }; 292 | name = Release; 293 | }; 294 | /* End XCBuildConfiguration section */ 295 | 296 | /* Begin XCConfigurationList section */ 297 | 93937C5817DB015300AB6F66 /* Build configuration list for PBXProject "AIMTableViewIndexBarExample" */ = { 298 | isa = XCConfigurationList; 299 | buildConfigurations = ( 300 | 93937C7817DB015300AB6F66 /* Debug */, 301 | 93937C7917DB015300AB6F66 /* Release */, 302 | ); 303 | defaultConfigurationIsVisible = 0; 304 | defaultConfigurationName = Release; 305 | }; 306 | 93937C7A17DB015300AB6F66 /* Build configuration list for PBXNativeTarget "AIMTableViewIndexBarExample" */ = { 307 | isa = XCConfigurationList; 308 | buildConfigurations = ( 309 | 93937C7B17DB015300AB6F66 /* Debug */, 310 | 93937C7C17DB015300AB6F66 /* Release */, 311 | ); 312 | defaultConfigurationIsVisible = 0; 313 | }; 314 | /* End XCConfigurationList section */ 315 | }; 316 | rootObject = 93937C5517DB015300AB6F66 /* Project object */; 317 | } 318 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample.xcodeproj/project.xcworkspace/xcuserdata/marekkotewicz.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/herodotdigital/AIMTableViewIndexBar/0c330e07b41c3acb6b7bce6a0563e81bb394b865/AIMTableViewIndexBarExample.xcodeproj/project.xcworkspace/xcuserdata/marekkotewicz.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample.xcodeproj/xcuserdata/marekkotewicz.xcuserdatad/xcschemes/AIMTableViewIndexBarExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 51 | 52 | 58 | 59 | 60 | 61 | 62 | 63 | 69 | 70 | 76 | 77 | 78 | 79 | 81 | 82 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample.xcodeproj/xcuserdata/marekkotewicz.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | AIMTableViewIndexBarExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 93937C5C17DB015300AB6F66 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/AIMTableViewIndexBarExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | AllInMobile.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/AIMTableViewIndexBarExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'AIMTableViewIndexBarExample' target in the 'AIMTableViewIndexBarExample' project 3 | // 4 | 5 | #import 6 | 7 | #ifndef __IPHONE_3_0 8 | #warning "This project uses features only available in iOS SDK 3.0 and later." 9 | #endif 10 | 11 | #ifdef __OBJC__ 12 | #import 13 | #import 14 | #endif 15 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // AIMTableViewIndexBarExample 4 | // 5 | // Created by Marek Kotewicz on 07.09.2013. 6 | // Copyright (c) 2013 AllInMobile. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import 28 | 29 | @interface AppDelegate : UIResponder 30 | 31 | @property (strong, nonatomic) UIWindow *window; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // AIMTableViewIndexBarExample 4 | // 5 | // Created by Marek Kotewicz on 07.09.2013. 6 | // Copyright (c) 2013 AllInMobile. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import "AppDelegate.h" 28 | #import "ExampleViewController.h" 29 | 30 | @implementation AppDelegate 31 | 32 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 33 | { 34 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 35 | // Override point for customization after application launch. 36 | self.window.backgroundColor = [UIColor whiteColor]; 37 | self.window.rootViewController = [[ExampleViewController alloc] init]; 38 | [self.window makeKeyAndVisible]; 39 | return YES; 40 | } 41 | 42 | - (void)applicationWillResignActive:(UIApplication *)application 43 | { 44 | // 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. 45 | // 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. 46 | } 47 | 48 | - (void)applicationDidEnterBackground:(UIApplication *)application 49 | { 50 | // 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. 51 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 52 | } 53 | 54 | - (void)applicationWillEnterForeground:(UIApplication *)application 55 | { 56 | // 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. 57 | } 58 | 59 | - (void)applicationDidBecomeActive:(UIApplication *)application 60 | { 61 | // 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. 62 | } 63 | 64 | - (void)applicationWillTerminate:(UIApplication *)application 65 | { 66 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 67 | } 68 | 69 | @end 70 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/herodotdigital/AIMTableViewIndexBar/0c330e07b41c3acb6b7bce6a0563e81bb394b865/AIMTableViewIndexBarExample/Default-568h@2x.png -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/herodotdigital/AIMTableViewIndexBar/0c330e07b41c3acb6b7bce6a0563e81bb394b865/AIMTableViewIndexBarExample/Default.png -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/herodotdigital/AIMTableViewIndexBar/0c330e07b41c3acb6b7bce6a0563e81bb394b865/AIMTableViewIndexBarExample/Default@2x.png -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/ExampleViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleViewController.h 3 | // AIMTableViewIndexBarExample 4 | // 5 | // Created by Marek Kotewicz on 07.09.2013. 6 | // Copyright (c) 2013 AllInMobile. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import 28 | 29 | @interface ExampleViewController : UIViewController 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/ExampleViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ExampleViewController.m 3 | // AIMTableViewIndexBarExample 4 | // 5 | // Created by Marek Kotewicz on 07.09.2013. 6 | // Copyright (c) 2013 AllInMobile. All rights reserved. 7 | // 8 | // Permission is hereby granted, free of charge, to any person obtaining a copy 9 | // of this software and associated documentation files (the "Software"), to deal 10 | // in the Software without restriction, including without limitation the rights 11 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | // copies of the Software, and to permit persons to whom the Software is 13 | // furnished to do so, subject to the following conditions: 14 | // 15 | // The above copyright notice and this permission notice shall be included in 16 | // all copies or substantial portions of the Software. 17 | // 18 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | // THE SOFTWARE. 25 | 26 | 27 | #import "ExampleViewController.h" 28 | #import "AIMTableViewIndexBar.h" 29 | 30 | @interface ExampleViewController ()< 31 | UITableViewDataSource, 32 | UITableViewDelegate, 33 | AIMTableViewIndexBarDelegate>{ 34 | __weak IBOutlet AIMTableViewIndexBar *indexBar; 35 | __weak IBOutlet UITableView *plainTableView; 36 | 37 | NSArray *sections; 38 | NSArray *rows; 39 | } 40 | 41 | @end 42 | 43 | @implementation ExampleViewController 44 | 45 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 46 | { 47 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 48 | if (self) { 49 | // Custom initialization 50 | } 51 | return self; 52 | } 53 | 54 | - (void)viewDidLoad 55 | { 56 | [super viewDidLoad]; 57 | // Do any additional setup after loading the view from its nib. 58 | sections = @[@"A", @"D", @"F", @"M", @"N", @"O", @"Z"]; 59 | 60 | rows = @[@[@"adam", @"alfred", @"ain", @"abdul", @"anastazja", @"angelica"], 61 | @[@"dennis" , @"deamon", @"destiny", @"dragon", @"dry", @"debug", @"drums"], 62 | @[@"Fredric", @"France", @"friends", @"family", @"fatish", @"funeral"], 63 | @[@"Mark", @"Madeline"], 64 | @[@"Nemesis", @"nemo", @"name"], 65 | @[@"Obama", @"Oprah", @"Omen", @"OMG OMG OMG", @"O-Zone", @"Ontario"], 66 | @[@"Zeus", @"Zebra", @"zed"]]; 67 | 68 | indexBar.delegate = self; 69 | } 70 | 71 | - (void)didReceiveMemoryWarning 72 | { 73 | [super didReceiveMemoryWarning]; 74 | // Dispose of any resources that can be recreated. 75 | } 76 | 77 | #pragma mark - UITableViewDelegate && UITableViewDataSource 78 | 79 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ 80 | [indexBar setIndexes:sections]; // to always have exact number of sections in table and indexBar 81 | return [sections count]; 82 | } 83 | 84 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 85 | return [rows[section] count]; 86 | } 87 | 88 | - (NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ 89 | return sections[section]; 90 | } 91 | 92 | - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 93 | static NSString *cellId = @"TableViewCellId"; 94 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId]; 95 | if (cell == nil){ 96 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; 97 | } 98 | [cell.textLabel setText:rows[indexPath.section][indexPath.row]]; 99 | return cell; 100 | } 101 | 102 | #pragma mark - AIMTableViewIndexBarDelegate 103 | 104 | - (void)tableViewIndexBar:(AIMTableViewIndexBar *)indexBar didSelectSectionAtIndex:(NSInteger)index{ 105 | if ([plainTableView numberOfSections] > index && index > -1){ // for safety, should always be YES 106 | [plainTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index] 107 | atScrollPosition:UITableViewScrollPositionTop 108 | animated:YES]; 109 | } 110 | } 111 | 112 | 113 | @end 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/ExampleViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1552 5 | 12C3103 6 | 3084 7 | 1187.34 8 | 625.00 9 | 10 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 11 | 2083 12 | 13 | 14 | IBProxyObject 15 | IBUITableView 16 | IBUIView 17 | 18 | 19 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 20 | 21 | 22 | PluginDependencyRecalculationVersion 23 | 24 | 25 | 26 | 27 | IBFilesOwner 28 | IBCocoaTouchFramework 29 | 30 | 31 | IBFirstResponder 32 | IBCocoaTouchFramework 33 | 34 | 35 | 36 | 274 37 | 38 | 39 | 40 | 274 41 | {300, 548} 42 | 43 | 44 | 45 | _NS:9 46 | 47 | 3 48 | MQA 49 | 50 | YES 51 | IBCocoaTouchFramework 52 | YES 53 | 1 54 | 0 55 | YES 56 | 44 57 | 22 58 | 22 59 | 60 | 61 | 62 | 273 63 | {{300, 0}, {20, 548}} 64 | 65 | 66 | 67 | _NS:9 68 | 69 | 3 70 | MQA 71 | 72 | 2 73 | 74 | 75 | IBCocoaTouchFramework 76 | 77 | 78 | {{0, 20}, {320, 548}} 79 | 80 | 81 | 82 | 83 | 3 84 | MQA 85 | 86 | 87 | 88 | 89 | IBUIScreenMetrics 90 | 91 | YES 92 | 93 | 94 | 95 | 96 | 97 | {320, 568} 98 | {568, 320} 99 | 100 | 101 | IBCocoaTouchFramework 102 | Retina 4 Full Screen 103 | 2 104 | 105 | IBCocoaTouchFramework 106 | 107 | 108 | 109 | 110 | 111 | 112 | view 113 | 114 | 115 | 116 | 3 117 | 118 | 119 | 120 | indexBar 121 | 122 | 123 | 124 | 18 125 | 126 | 127 | 128 | plainTableView 129 | 130 | 131 | 132 | 19 133 | 134 | 135 | 136 | dataSource 137 | 138 | 139 | 140 | 16 141 | 142 | 143 | 144 | delegate 145 | 146 | 147 | 148 | 17 149 | 150 | 151 | 152 | 153 | 154 | 0 155 | 156 | 157 | 158 | 159 | 160 | 1 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -1 170 | 171 | 172 | File's Owner 173 | 174 | 175 | -2 176 | 177 | 178 | 179 | 180 | 4 181 | 182 | 183 | 184 | 185 | 186 | 15 187 | 188 | 189 | 190 | 191 | 192 | 193 | ExampleViewController 194 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 195 | UIResponder 196 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 197 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 198 | AIMTableViewIndexBar 199 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 200 | com.apple.InterfaceBuilder.IBCocoaTouchPlugin 201 | 202 | 203 | 204 | 205 | 206 | 19 207 | 208 | 209 | 210 | 211 | AIMTableViewIndexBar 212 | UIView 213 | 214 | IBProjectSource 215 | ./Classes/AIMTableViewIndexBar.h 216 | 217 | 218 | 219 | ExampleViewController 220 | UIViewController 221 | 222 | AIMTableViewIndexBar 223 | UITableView 224 | 225 | 226 | 227 | indexBar 228 | AIMTableViewIndexBar 229 | 230 | 231 | plainTableView 232 | UITableView 233 | 234 | 235 | 236 | IBProjectSource 237 | ./Classes/ExampleViewController.h 238 | 239 | 240 | 241 | 242 | 0 243 | IBCocoaTouchFramework 244 | YES 245 | 3 246 | 2083 247 | 248 | 249 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /AIMTableViewIndexBarExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // AIMTableViewIndexBarExample 4 | // 5 | // Created by Marek Kotewicz on 07.09.2013. 6 | // Copyright (c) 2013 AllInMobile. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013 debris 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AIMTableViewIndexBar 2 | ==================== 3 | 4 | Custom index bar for UITableView 5 | 6 | ```bash 7 | pod 'AIMTableViewIndexBar', '~> 0.1.1' 8 | ``` 9 | 10 |

11 | 12 |

13 | --------------------------------------------------------------------------------