├── .gitignore
├── README.md
├── ScreenShot.gif
├── ZTLetterIndex
├── ZTLetterIndex.h
└── ZTLetterIndex.m
└── ZTLetterIndexDemo
├── ZTLetterIndexDemo.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ └── contents.xcworkspacedata
├── ZTLetterIndexDemo
├── AppDelegate.h
├── AppDelegate.m
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
├── Info.plist
├── ViewController.h
├── ViewController.m
└── main.m
├── ZTLetterIndexDemoTests
├── Info.plist
└── ZTLetterIndexDemoTests.m
└── ZTLetterIndexDemoUITests
├── Info.plist
└── ZTLetterIndexDemoUITests.m
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xcuserstate
23 |
24 | ## Obj-C/Swift specific
25 | *.hmap
26 | *.ipa
27 | *.dSYM.zip
28 | *.dSYM
29 |
30 | # CocoaPods
31 | #
32 | # We recommend against adding the Pods directory to your .gitignore. However
33 | # you should judge for yourself, the pros and cons are mentioned at:
34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
35 | #
36 | # Pods/
37 |
38 | # Carthage
39 | #
40 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
41 | # Carthage/Checkouts
42 |
43 | Carthage/Build
44 |
45 | # fastlane
46 | #
47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
48 | # screenshots whenever they are needed.
49 | # For more information about the recommended setup visit:
50 | # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
51 |
52 | fastlane/report.xml
53 | fastlane/screenshots
54 |
55 | #Code Injection
56 | #
57 | # After new code Injection tools there's a generated folder /iOSInjectionProject
58 | # https://github.com/johnno1962/injectionforxcode
59 |
60 | iOSInjectionProject/
61 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ZTLetterIndex
2 |
3 | 
4 |
5 | ### 注意
6 |
7 | @property(nonatomic, strong) NSArray *dataArray
8 |
9 | **该属性要在其他属性赋值后赋值**
10 |
11 | 个人博客:[http://www.jianshu.com/u/5c50ecd9c410](http://www.jianshu.com/u/5c50ecd9c410)
12 |
--------------------------------------------------------------------------------
/ScreenShot.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/JoviZT/ZTLetterIndex/027ab54ce98820060bcec58b09b564e6e3c07cb8/ScreenShot.gif
--------------------------------------------------------------------------------
/ZTLetterIndex/ZTLetterIndex.h:
--------------------------------------------------------------------------------
1 | //
2 | // ZTLetterIndex.h
3 | // ZTLetterIndexDemo
4 | //
5 | // Created by 赵天福 on 2017/3/20.
6 | // Copyright © 2017年 赵天福. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class ZTLetterIndex;
12 |
13 | @protocol ZTLetterIndexDelegate
14 |
15 | /**
16 | 点击回调
17 | */
18 | - (void)ZTLetterIndex:(ZTLetterIndex *)indexView didSelectedItemWithIndex:(NSInteger)index;
19 |
20 | /**
21 | 滑动时回调
22 | */
23 | - (void)ZTLetterIndex:(ZTLetterIndex *)indexView isChangingItemWithIndex:(NSInteger)index;
24 |
25 | /**
26 | 滑动开始回调
27 | */
28 | - (void)ZTLetterIndex:(ZTLetterIndex *)indexView beginChangeItemWithIndex:(NSInteger)index;
29 |
30 | /**
31 | 滑动结束回调
32 | */
33 | - (void)ZTLetterIndex:(ZTLetterIndex *)indexView endChangeItemWithIndex:(NSInteger)index;
34 |
35 | @end
36 |
37 | @interface ZTLetterIndex : UIView
38 |
39 | /**
40 | 必填参数,数据源,其他属性赋值后最后赋值
41 | */
42 | @property(nonatomic, strong) NSArray *dataArray;
43 |
44 | /**
45 | item尺寸,默认CGSizeMake(12.0f, 16.0f)
46 | */
47 | @property(nonatomic, assign) CGSize itemSize;
48 |
49 | /**
50 | 滑块Size,默认宽度等于itemSize,CGSizeMake(12.0f, 40.0f)
51 | */
52 | @property(nonatomic, assign) CGSize sliderSize;
53 |
54 | /**
55 | 文字字体,默认PingFangSC-Medium size:11
56 | */
57 | @property(nonatomic, strong) UIFont *textFont;
58 | /**
59 | 文字颜色,默认lightGrayColor
60 | */
61 | @property(nonatomic, strong) UIColor *textColor;
62 |
63 | /**
64 | 选中文字颜色,默认whiteColor
65 | */
66 | @property(nonatomic, strong) UIColor *selectedTextColor;
67 |
68 | /**
69 | slider颜色,默认lightGrayColor
70 | */
71 | @property(nonatomic, strong) UIColor *sliderColor;
72 |
73 | /**
74 | slider与上下Item间隙,默认4.0f
75 | */
76 | @property(nonatomic, assign) CGFloat sliderSpace;
77 |
78 | - (void)selectIndex:(NSInteger)index;
79 |
80 | @property(nonatomic, assign) iddelegate;
81 |
82 | @end
83 |
--------------------------------------------------------------------------------
/ZTLetterIndex/ZTLetterIndex.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZTLetterIndex.h
3 | // ZTLetterIndexDemo
4 | //
5 | // Created by 赵天福 on 2017/3/20.
6 | // Copyright © 2017年 赵天福. All rights reserved.
7 | //
8 |
9 | #import "ZTLetterIndex.h"
10 |
11 | #define kAnimationDuration 0.2f
12 |
13 | @interface ZTLetterIndex ()
14 | {
15 | NSInteger _lastIndex;
16 | CALayer *_slidr;
17 | }
18 |
19 | @end
20 |
21 | @implementation ZTLetterIndex
22 |
23 | - (instancetype)initWithFrame:(CGRect)frame
24 | {
25 | self = [super initWithFrame:frame];
26 | if (self) {
27 | _lastIndex = 0;
28 | self.textColor = [UIColor lightGrayColor];
29 | self.selectedTextColor = [UIColor whiteColor];
30 | self.itemSize = CGSizeMake(12.0f, 16.0f);
31 | self.sliderSize = CGSizeMake(12.0f, 40.0f);
32 | self.sliderColor = [UIColor lightGrayColor];
33 | self.textFont = [UIFont fontWithName:@"PingFangSC-Medium" size:11.0f];
34 | self.sliderSpace = 4.0f;
35 | }
36 | return self;
37 | }
38 |
39 | - (void)setDataArray:(NSArray *)dataArray
40 | {
41 | _dataArray = dataArray;
42 | [self setupItems];
43 | }
44 |
45 | - (void)setupItems
46 | {
47 | _slidr = [CALayer layer];
48 | _slidr.frame = CGRectMake((self.bounds.size.width - self.sliderSize.width)/2, 0, self.sliderSize.width, self.sliderSize.height + 2*self.sliderSpace);
49 | _slidr.backgroundColor = [UIColor clearColor].CGColor;
50 | [self.layer addSublayer:_slidr];
51 |
52 | CALayer *slidrColor = [CALayer layer];
53 | slidrColor = [CALayer layer];
54 | slidrColor.frame = CGRectMake(0, self.sliderSpace, self.sliderSize.width, self.sliderSize.height);
55 | slidrColor.cornerRadius = slidrColor.bounds.size.width/2;
56 | slidrColor.backgroundColor = self.sliderColor.CGColor;
57 | [_slidr addSublayer:slidrColor];
58 |
59 | [self.dataArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
60 | UILabel *item = [[UILabel alloc] init];
61 | item.frame = CGRectMake((self.bounds.size.width - self.itemSize.width)/2, self.itemSize.height * idx + (_slidr.bounds.size.height - self.itemSize.height), self.itemSize.width, self.itemSize.height);
62 | item.backgroundColor = [UIColor clearColor];
63 | item.text = [NSString stringWithFormat:@"%@",obj];
64 | item.font = self.textFont;
65 | item.textAlignment = NSTextAlignmentCenter;
66 | item.textColor = self.textColor;
67 | item.tag = 999 + idx;
68 | item.layer.masksToBounds = NO;
69 | item.userInteractionEnabled = YES;
70 | [self addSubview:item];
71 |
72 | UITapGestureRecognizer *singleTapGR;
73 | UILongPressGestureRecognizer *longPressGR;
74 |
75 | longPressGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(touchLong:)];
76 | longPressGR.allowableMovement=NO;
77 | longPressGR.minimumPressDuration = 0.2;
78 |
79 | singleTapGR = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchDown:)];
80 | singleTapGR.numberOfTapsRequired = 1;
81 | singleTapGR.numberOfTouchesRequired = 1;
82 | [item addGestureRecognizer:longPressGR];
83 | [item addGestureRecognizer:singleTapGR];
84 | }];
85 |
86 | UILabel *firstItem = (UILabel *)[self viewWithTag:999];
87 | firstItem.frame = CGRectMake(0, 0, self.itemSize.width, _slidr.bounds.size.height);
88 | firstItem.textColor = self.selectedTextColor;
89 | }
90 |
91 | - (void)touchDown:(UITapGestureRecognizer *)recognizer
92 | {
93 | UILabel *item = (UILabel *)recognizer.view;
94 | [self selectIndex:item.tag - 999];
95 | if (self.delegate && [self.delegate respondsToSelector:@selector(ZTLetterIndex:didSelectedItemWithIndex:)]) {
96 | [self.delegate ZTLetterIndex:self didSelectedItemWithIndex:item.tag - 999];
97 | }
98 | }
99 |
100 | - (void)touchLong:(UILongPressGestureRecognizer *)recognizer
101 | {
102 | UILabel *item = (UILabel *)recognizer.view;
103 | if (recognizer.state == UIGestureRecognizerStateBegan) {
104 | [self selectIndex:item.tag - 999];
105 | if (self.delegate && [self.delegate respondsToSelector:@selector(ZTLetterIndex:beginChangeItemWithIndex:)]) {
106 | [self.delegate ZTLetterIndex:self beginChangeItemWithIndex:item.tag - 999];
107 | }
108 | }
109 | else if (recognizer.state == UIGestureRecognizerStateChanged) {
110 | CGPoint point = [recognizer locationInView:self];
111 |
112 | if (point.y < _lastIndex * self.itemSize.height && point.y > 0) {
113 | [self selectIndex:_lastIndex - 1];
114 | }
115 | else if (point.y > _lastIndex * self.itemSize.height + _slidr.bounds.size.height && point.y < self.itemSize.height * self.dataArray.count + _slidr.bounds.size.height - self.itemSize.height) {
116 | [self selectIndex:_lastIndex + 1];
117 | }
118 | if (self.delegate && [self.delegate respondsToSelector:@selector(ZTLetterIndex:isChangingItemWithIndex:)]) {
119 | [self.delegate ZTLetterIndex:self isChangingItemWithIndex:_lastIndex];
120 | }
121 | }
122 | else if (recognizer.state == UIGestureRecognizerStateEnded || recognizer.state == UIGestureRecognizerStateCancelled) {
123 | if (self.delegate && [self.delegate respondsToSelector:@selector(ZTLetterIndex:endChangeItemWithIndex:)]) {
124 | [self.delegate ZTLetterIndex:self endChangeItemWithIndex:_lastIndex];
125 | }
126 | }
127 |
128 | }
129 |
130 | - (void)selectIndex:(NSInteger)index;
131 | {
132 | UILabel *item = (UILabel *)[self viewWithTag:index + 999];
133 |
134 | if (item.tag - 999 == _lastIndex) {
135 | return;
136 | }
137 |
138 | UILabel *oldItem = [self viewWithTag:_lastIndex + 999];
139 |
140 | [UIView animateWithDuration:kAnimationDuration
141 | animations:^{
142 | _slidr.frame = CGRectMake(_slidr.frame.origin.x, index*self.itemSize.height, _slidr.bounds.size.width, _slidr.bounds.size.height);
143 | }
144 | completion:^(BOOL finished) {
145 | item.textColor = self.selectedTextColor;
146 | oldItem.textColor = self.textColor;
147 | }];
148 |
149 | if (oldItem.tag < item.tag) {
150 | oldItem.frame = CGRectMake(oldItem.frame.origin.x, oldItem.frame.origin.y + (_slidr.bounds.size.height - self.itemSize.height), self.itemSize.width, self.itemSize.height);
151 | for (int i = (int)_lastIndex; i < item.tag - 999; ++i) {
152 | UILabel *changeItem = [self viewWithTag:i + 999];
153 | changeItem.frame = CGRectMake(changeItem.frame.origin.x, changeItem.frame.origin.y - (_slidr.bounds.size.height - self.itemSize.height), changeItem.bounds.size.width, changeItem.bounds.size.height);
154 | }
155 | item.frame = _slidr.frame;
156 | }
157 | else if (oldItem.tag > item.tag) {
158 | oldItem.frame = CGRectMake(oldItem.frame.origin.x, oldItem.frame.origin.y + (_slidr.bounds.size.height - self.itemSize.height), self.itemSize.width, self.itemSize.height);
159 | for (int i = (int)item.tag - 999 + 1; i < _lastIndex; ++i) {
160 | UIButton *changeItem = [self viewWithTag:i + 999];
161 | changeItem.frame = CGRectMake(changeItem.frame.origin.x, changeItem.frame.origin.y + (_slidr.bounds.size.height - self.itemSize.height), changeItem.bounds.size.width, changeItem.bounds.size.height);
162 | }
163 | item.frame = _slidr.frame;
164 | }
165 | _lastIndex = item.tag - 999;
166 | }
167 |
168 | @end
169 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 7B1D089A1E8CFC24005E841A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D08991E8CFC24005E841A /* main.m */; };
11 | 7B1D089D1E8CFC24005E841A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D089C1E8CFC24005E841A /* AppDelegate.m */; };
12 | 7B1D08A01E8CFC24005E841A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D089F1E8CFC24005E841A /* ViewController.m */; };
13 | 7B1D08A31E8CFC24005E841A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B1D08A11E8CFC24005E841A /* Main.storyboard */; };
14 | 7B1D08A51E8CFC24005E841A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 7B1D08A41E8CFC24005E841A /* Assets.xcassets */; };
15 | 7B1D08A81E8CFC24005E841A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B1D08A61E8CFC24005E841A /* LaunchScreen.storyboard */; };
16 | 7B1D08B31E8CFC24005E841A /* ZTLetterIndexDemoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D08B21E8CFC24005E841A /* ZTLetterIndexDemoTests.m */; };
17 | 7B1D08BE1E8CFC24005E841A /* ZTLetterIndexDemoUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D08BD1E8CFC24005E841A /* ZTLetterIndexDemoUITests.m */; };
18 | 7B1D08D21E8CFD3C005E841A /* ZTLetterIndex.m in Sources */ = {isa = PBXBuildFile; fileRef = 7B1D08D11E8CFD3C005E841A /* ZTLetterIndex.m */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXContainerItemProxy section */
22 | 7B1D08AF1E8CFC24005E841A /* PBXContainerItemProxy */ = {
23 | isa = PBXContainerItemProxy;
24 | containerPortal = 7B1D088D1E8CFC24005E841A /* Project object */;
25 | proxyType = 1;
26 | remoteGlobalIDString = 7B1D08941E8CFC24005E841A;
27 | remoteInfo = ZTLetterIndexDemo;
28 | };
29 | 7B1D08BA1E8CFC24005E841A /* PBXContainerItemProxy */ = {
30 | isa = PBXContainerItemProxy;
31 | containerPortal = 7B1D088D1E8CFC24005E841A /* Project object */;
32 | proxyType = 1;
33 | remoteGlobalIDString = 7B1D08941E8CFC24005E841A;
34 | remoteInfo = ZTLetterIndexDemo;
35 | };
36 | /* End PBXContainerItemProxy section */
37 |
38 | /* Begin PBXFileReference section */
39 | 7B1D08951E8CFC24005E841A /* ZTLetterIndexDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ZTLetterIndexDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
40 | 7B1D08991E8CFC24005E841A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
41 | 7B1D089B1E8CFC24005E841A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
42 | 7B1D089C1E8CFC24005E841A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
43 | 7B1D089E1E8CFC24005E841A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
44 | 7B1D089F1E8CFC24005E841A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
45 | 7B1D08A21E8CFC24005E841A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
46 | 7B1D08A41E8CFC24005E841A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
47 | 7B1D08A71E8CFC24005E841A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
48 | 7B1D08A91E8CFC24005E841A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | 7B1D08AE1E8CFC24005E841A /* ZTLetterIndexDemoTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZTLetterIndexDemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
50 | 7B1D08B21E8CFC24005E841A /* ZTLetterIndexDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZTLetterIndexDemoTests.m; sourceTree = ""; };
51 | 7B1D08B41E8CFC24005E841A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
52 | 7B1D08B91E8CFC24005E841A /* ZTLetterIndexDemoUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ZTLetterIndexDemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
53 | 7B1D08BD1E8CFC24005E841A /* ZTLetterIndexDemoUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZTLetterIndexDemoUITests.m; sourceTree = ""; };
54 | 7B1D08BF1E8CFC24005E841A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
55 | 7B1D08D01E8CFD3C005E841A /* ZTLetterIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZTLetterIndex.h; sourceTree = ""; };
56 | 7B1D08D11E8CFD3C005E841A /* ZTLetterIndex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ZTLetterIndex.m; sourceTree = ""; };
57 | /* End PBXFileReference section */
58 |
59 | /* Begin PBXFrameworksBuildPhase section */
60 | 7B1D08921E8CFC24005E841A /* Frameworks */ = {
61 | isa = PBXFrameworksBuildPhase;
62 | buildActionMask = 2147483647;
63 | files = (
64 | );
65 | runOnlyForDeploymentPostprocessing = 0;
66 | };
67 | 7B1D08AB1E8CFC24005E841A /* Frameworks */ = {
68 | isa = PBXFrameworksBuildPhase;
69 | buildActionMask = 2147483647;
70 | files = (
71 | );
72 | runOnlyForDeploymentPostprocessing = 0;
73 | };
74 | 7B1D08B61E8CFC24005E841A /* Frameworks */ = {
75 | isa = PBXFrameworksBuildPhase;
76 | buildActionMask = 2147483647;
77 | files = (
78 | );
79 | runOnlyForDeploymentPostprocessing = 0;
80 | };
81 | /* End PBXFrameworksBuildPhase section */
82 |
83 | /* Begin PBXGroup section */
84 | 7B1D088C1E8CFC24005E841A = {
85 | isa = PBXGroup;
86 | children = (
87 | 7B1D08CF1E8CFD3C005E841A /* ZTLetterIndex */,
88 | 7B1D08971E8CFC24005E841A /* ZTLetterIndexDemo */,
89 | 7B1D08B11E8CFC24005E841A /* ZTLetterIndexDemoTests */,
90 | 7B1D08BC1E8CFC24005E841A /* ZTLetterIndexDemoUITests */,
91 | 7B1D08961E8CFC24005E841A /* Products */,
92 | );
93 | sourceTree = "";
94 | };
95 | 7B1D08961E8CFC24005E841A /* Products */ = {
96 | isa = PBXGroup;
97 | children = (
98 | 7B1D08951E8CFC24005E841A /* ZTLetterIndexDemo.app */,
99 | 7B1D08AE1E8CFC24005E841A /* ZTLetterIndexDemoTests.xctest */,
100 | 7B1D08B91E8CFC24005E841A /* ZTLetterIndexDemoUITests.xctest */,
101 | );
102 | name = Products;
103 | sourceTree = "";
104 | };
105 | 7B1D08971E8CFC24005E841A /* ZTLetterIndexDemo */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 7B1D089B1E8CFC24005E841A /* AppDelegate.h */,
109 | 7B1D089C1E8CFC24005E841A /* AppDelegate.m */,
110 | 7B1D089E1E8CFC24005E841A /* ViewController.h */,
111 | 7B1D089F1E8CFC24005E841A /* ViewController.m */,
112 | 7B1D08A11E8CFC24005E841A /* Main.storyboard */,
113 | 7B1D08A41E8CFC24005E841A /* Assets.xcassets */,
114 | 7B1D08A61E8CFC24005E841A /* LaunchScreen.storyboard */,
115 | 7B1D08A91E8CFC24005E841A /* Info.plist */,
116 | 7B1D08981E8CFC24005E841A /* Supporting Files */,
117 | );
118 | path = ZTLetterIndexDemo;
119 | sourceTree = "";
120 | };
121 | 7B1D08981E8CFC24005E841A /* Supporting Files */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 7B1D08991E8CFC24005E841A /* main.m */,
125 | );
126 | name = "Supporting Files";
127 | sourceTree = "";
128 | };
129 | 7B1D08B11E8CFC24005E841A /* ZTLetterIndexDemoTests */ = {
130 | isa = PBXGroup;
131 | children = (
132 | 7B1D08B21E8CFC24005E841A /* ZTLetterIndexDemoTests.m */,
133 | 7B1D08B41E8CFC24005E841A /* Info.plist */,
134 | );
135 | path = ZTLetterIndexDemoTests;
136 | sourceTree = "";
137 | };
138 | 7B1D08BC1E8CFC24005E841A /* ZTLetterIndexDemoUITests */ = {
139 | isa = PBXGroup;
140 | children = (
141 | 7B1D08BD1E8CFC24005E841A /* ZTLetterIndexDemoUITests.m */,
142 | 7B1D08BF1E8CFC24005E841A /* Info.plist */,
143 | );
144 | path = ZTLetterIndexDemoUITests;
145 | sourceTree = "";
146 | };
147 | 7B1D08CF1E8CFD3C005E841A /* ZTLetterIndex */ = {
148 | isa = PBXGroup;
149 | children = (
150 | 7B1D08D01E8CFD3C005E841A /* ZTLetterIndex.h */,
151 | 7B1D08D11E8CFD3C005E841A /* ZTLetterIndex.m */,
152 | );
153 | name = ZTLetterIndex;
154 | path = ../ZTLetterIndex;
155 | sourceTree = "";
156 | };
157 | /* End PBXGroup section */
158 |
159 | /* Begin PBXNativeTarget section */
160 | 7B1D08941E8CFC24005E841A /* ZTLetterIndexDemo */ = {
161 | isa = PBXNativeTarget;
162 | buildConfigurationList = 7B1D08C21E8CFC24005E841A /* Build configuration list for PBXNativeTarget "ZTLetterIndexDemo" */;
163 | buildPhases = (
164 | 7B1D08911E8CFC24005E841A /* Sources */,
165 | 7B1D08921E8CFC24005E841A /* Frameworks */,
166 | 7B1D08931E8CFC24005E841A /* Resources */,
167 | );
168 | buildRules = (
169 | );
170 | dependencies = (
171 | );
172 | name = ZTLetterIndexDemo;
173 | productName = ZTLetterIndexDemo;
174 | productReference = 7B1D08951E8CFC24005E841A /* ZTLetterIndexDemo.app */;
175 | productType = "com.apple.product-type.application";
176 | };
177 | 7B1D08AD1E8CFC24005E841A /* ZTLetterIndexDemoTests */ = {
178 | isa = PBXNativeTarget;
179 | buildConfigurationList = 7B1D08C51E8CFC24005E841A /* Build configuration list for PBXNativeTarget "ZTLetterIndexDemoTests" */;
180 | buildPhases = (
181 | 7B1D08AA1E8CFC24005E841A /* Sources */,
182 | 7B1D08AB1E8CFC24005E841A /* Frameworks */,
183 | 7B1D08AC1E8CFC24005E841A /* Resources */,
184 | );
185 | buildRules = (
186 | );
187 | dependencies = (
188 | 7B1D08B01E8CFC24005E841A /* PBXTargetDependency */,
189 | );
190 | name = ZTLetterIndexDemoTests;
191 | productName = ZTLetterIndexDemoTests;
192 | productReference = 7B1D08AE1E8CFC24005E841A /* ZTLetterIndexDemoTests.xctest */;
193 | productType = "com.apple.product-type.bundle.unit-test";
194 | };
195 | 7B1D08B81E8CFC24005E841A /* ZTLetterIndexDemoUITests */ = {
196 | isa = PBXNativeTarget;
197 | buildConfigurationList = 7B1D08C81E8CFC24005E841A /* Build configuration list for PBXNativeTarget "ZTLetterIndexDemoUITests" */;
198 | buildPhases = (
199 | 7B1D08B51E8CFC24005E841A /* Sources */,
200 | 7B1D08B61E8CFC24005E841A /* Frameworks */,
201 | 7B1D08B71E8CFC24005E841A /* Resources */,
202 | );
203 | buildRules = (
204 | );
205 | dependencies = (
206 | 7B1D08BB1E8CFC24005E841A /* PBXTargetDependency */,
207 | );
208 | name = ZTLetterIndexDemoUITests;
209 | productName = ZTLetterIndexDemoUITests;
210 | productReference = 7B1D08B91E8CFC24005E841A /* ZTLetterIndexDemoUITests.xctest */;
211 | productType = "com.apple.product-type.bundle.ui-testing";
212 | };
213 | /* End PBXNativeTarget section */
214 |
215 | /* Begin PBXProject section */
216 | 7B1D088D1E8CFC24005E841A /* Project object */ = {
217 | isa = PBXProject;
218 | attributes = {
219 | LastUpgradeCheck = 0830;
220 | ORGANIZATIONNAME = zt;
221 | TargetAttributes = {
222 | 7B1D08941E8CFC24005E841A = {
223 | CreatedOnToolsVersion = 8.3;
224 | ProvisioningStyle = Automatic;
225 | };
226 | 7B1D08AD1E8CFC24005E841A = {
227 | CreatedOnToolsVersion = 8.3;
228 | ProvisioningStyle = Automatic;
229 | TestTargetID = 7B1D08941E8CFC24005E841A;
230 | };
231 | 7B1D08B81E8CFC24005E841A = {
232 | CreatedOnToolsVersion = 8.3;
233 | ProvisioningStyle = Automatic;
234 | TestTargetID = 7B1D08941E8CFC24005E841A;
235 | };
236 | };
237 | };
238 | buildConfigurationList = 7B1D08901E8CFC24005E841A /* Build configuration list for PBXProject "ZTLetterIndexDemo" */;
239 | compatibilityVersion = "Xcode 3.2";
240 | developmentRegion = English;
241 | hasScannedForEncodings = 0;
242 | knownRegions = (
243 | en,
244 | Base,
245 | );
246 | mainGroup = 7B1D088C1E8CFC24005E841A;
247 | productRefGroup = 7B1D08961E8CFC24005E841A /* Products */;
248 | projectDirPath = "";
249 | projectRoot = "";
250 | targets = (
251 | 7B1D08941E8CFC24005E841A /* ZTLetterIndexDemo */,
252 | 7B1D08AD1E8CFC24005E841A /* ZTLetterIndexDemoTests */,
253 | 7B1D08B81E8CFC24005E841A /* ZTLetterIndexDemoUITests */,
254 | );
255 | };
256 | /* End PBXProject section */
257 |
258 | /* Begin PBXResourcesBuildPhase section */
259 | 7B1D08931E8CFC24005E841A /* Resources */ = {
260 | isa = PBXResourcesBuildPhase;
261 | buildActionMask = 2147483647;
262 | files = (
263 | 7B1D08A81E8CFC24005E841A /* LaunchScreen.storyboard in Resources */,
264 | 7B1D08A51E8CFC24005E841A /* Assets.xcassets in Resources */,
265 | 7B1D08A31E8CFC24005E841A /* Main.storyboard in Resources */,
266 | );
267 | runOnlyForDeploymentPostprocessing = 0;
268 | };
269 | 7B1D08AC1E8CFC24005E841A /* Resources */ = {
270 | isa = PBXResourcesBuildPhase;
271 | buildActionMask = 2147483647;
272 | files = (
273 | );
274 | runOnlyForDeploymentPostprocessing = 0;
275 | };
276 | 7B1D08B71E8CFC24005E841A /* Resources */ = {
277 | isa = PBXResourcesBuildPhase;
278 | buildActionMask = 2147483647;
279 | files = (
280 | );
281 | runOnlyForDeploymentPostprocessing = 0;
282 | };
283 | /* End PBXResourcesBuildPhase section */
284 |
285 | /* Begin PBXSourcesBuildPhase section */
286 | 7B1D08911E8CFC24005E841A /* Sources */ = {
287 | isa = PBXSourcesBuildPhase;
288 | buildActionMask = 2147483647;
289 | files = (
290 | 7B1D08D21E8CFD3C005E841A /* ZTLetterIndex.m in Sources */,
291 | 7B1D08A01E8CFC24005E841A /* ViewController.m in Sources */,
292 | 7B1D089D1E8CFC24005E841A /* AppDelegate.m in Sources */,
293 | 7B1D089A1E8CFC24005E841A /* main.m in Sources */,
294 | );
295 | runOnlyForDeploymentPostprocessing = 0;
296 | };
297 | 7B1D08AA1E8CFC24005E841A /* Sources */ = {
298 | isa = PBXSourcesBuildPhase;
299 | buildActionMask = 2147483647;
300 | files = (
301 | 7B1D08B31E8CFC24005E841A /* ZTLetterIndexDemoTests.m in Sources */,
302 | );
303 | runOnlyForDeploymentPostprocessing = 0;
304 | };
305 | 7B1D08B51E8CFC24005E841A /* Sources */ = {
306 | isa = PBXSourcesBuildPhase;
307 | buildActionMask = 2147483647;
308 | files = (
309 | 7B1D08BE1E8CFC24005E841A /* ZTLetterIndexDemoUITests.m in Sources */,
310 | );
311 | runOnlyForDeploymentPostprocessing = 0;
312 | };
313 | /* End PBXSourcesBuildPhase section */
314 |
315 | /* Begin PBXTargetDependency section */
316 | 7B1D08B01E8CFC24005E841A /* PBXTargetDependency */ = {
317 | isa = PBXTargetDependency;
318 | target = 7B1D08941E8CFC24005E841A /* ZTLetterIndexDemo */;
319 | targetProxy = 7B1D08AF1E8CFC24005E841A /* PBXContainerItemProxy */;
320 | };
321 | 7B1D08BB1E8CFC24005E841A /* PBXTargetDependency */ = {
322 | isa = PBXTargetDependency;
323 | target = 7B1D08941E8CFC24005E841A /* ZTLetterIndexDemo */;
324 | targetProxy = 7B1D08BA1E8CFC24005E841A /* PBXContainerItemProxy */;
325 | };
326 | /* End PBXTargetDependency section */
327 |
328 | /* Begin PBXVariantGroup section */
329 | 7B1D08A11E8CFC24005E841A /* Main.storyboard */ = {
330 | isa = PBXVariantGroup;
331 | children = (
332 | 7B1D08A21E8CFC24005E841A /* Base */,
333 | );
334 | name = Main.storyboard;
335 | sourceTree = "";
336 | };
337 | 7B1D08A61E8CFC24005E841A /* LaunchScreen.storyboard */ = {
338 | isa = PBXVariantGroup;
339 | children = (
340 | 7B1D08A71E8CFC24005E841A /* Base */,
341 | );
342 | name = LaunchScreen.storyboard;
343 | sourceTree = "";
344 | };
345 | /* End PBXVariantGroup section */
346 |
347 | /* Begin XCBuildConfiguration section */
348 | 7B1D08C01E8CFC24005E841A /* Debug */ = {
349 | isa = XCBuildConfiguration;
350 | buildSettings = {
351 | ALWAYS_SEARCH_USER_PATHS = NO;
352 | CLANG_ANALYZER_NONNULL = YES;
353 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
354 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
355 | CLANG_CXX_LIBRARY = "libc++";
356 | CLANG_ENABLE_MODULES = YES;
357 | CLANG_ENABLE_OBJC_ARC = YES;
358 | CLANG_WARN_BOOL_CONVERSION = YES;
359 | CLANG_WARN_CONSTANT_CONVERSION = YES;
360 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
361 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
362 | CLANG_WARN_EMPTY_BODY = YES;
363 | CLANG_WARN_ENUM_CONVERSION = YES;
364 | CLANG_WARN_INFINITE_RECURSION = YES;
365 | CLANG_WARN_INT_CONVERSION = YES;
366 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
367 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
368 | CLANG_WARN_UNREACHABLE_CODE = YES;
369 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
370 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
371 | COPY_PHASE_STRIP = NO;
372 | DEBUG_INFORMATION_FORMAT = dwarf;
373 | ENABLE_STRICT_OBJC_MSGSEND = YES;
374 | ENABLE_TESTABILITY = YES;
375 | GCC_C_LANGUAGE_STANDARD = gnu99;
376 | GCC_DYNAMIC_NO_PIC = NO;
377 | GCC_NO_COMMON_BLOCKS = YES;
378 | GCC_OPTIMIZATION_LEVEL = 0;
379 | GCC_PREPROCESSOR_DEFINITIONS = (
380 | "DEBUG=1",
381 | "$(inherited)",
382 | );
383 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
384 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
385 | GCC_WARN_UNDECLARED_SELECTOR = YES;
386 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
387 | GCC_WARN_UNUSED_FUNCTION = YES;
388 | GCC_WARN_UNUSED_VARIABLE = YES;
389 | IPHONEOS_DEPLOYMENT_TARGET = 10.3;
390 | MTL_ENABLE_DEBUG_INFO = YES;
391 | ONLY_ACTIVE_ARCH = YES;
392 | SDKROOT = iphoneos;
393 | };
394 | name = Debug;
395 | };
396 | 7B1D08C11E8CFC24005E841A /* Release */ = {
397 | isa = XCBuildConfiguration;
398 | buildSettings = {
399 | ALWAYS_SEARCH_USER_PATHS = NO;
400 | CLANG_ANALYZER_NONNULL = YES;
401 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
402 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
403 | CLANG_CXX_LIBRARY = "libc++";
404 | CLANG_ENABLE_MODULES = YES;
405 | CLANG_ENABLE_OBJC_ARC = YES;
406 | CLANG_WARN_BOOL_CONVERSION = YES;
407 | CLANG_WARN_CONSTANT_CONVERSION = YES;
408 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
409 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
410 | CLANG_WARN_EMPTY_BODY = YES;
411 | CLANG_WARN_ENUM_CONVERSION = YES;
412 | CLANG_WARN_INFINITE_RECURSION = YES;
413 | CLANG_WARN_INT_CONVERSION = YES;
414 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
415 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
416 | CLANG_WARN_UNREACHABLE_CODE = YES;
417 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
418 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
419 | COPY_PHASE_STRIP = NO;
420 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
421 | ENABLE_NS_ASSERTIONS = NO;
422 | ENABLE_STRICT_OBJC_MSGSEND = YES;
423 | GCC_C_LANGUAGE_STANDARD = gnu99;
424 | GCC_NO_COMMON_BLOCKS = YES;
425 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
426 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
427 | GCC_WARN_UNDECLARED_SELECTOR = YES;
428 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
429 | GCC_WARN_UNUSED_FUNCTION = YES;
430 | GCC_WARN_UNUSED_VARIABLE = YES;
431 | IPHONEOS_DEPLOYMENT_TARGET = 10.3;
432 | MTL_ENABLE_DEBUG_INFO = NO;
433 | SDKROOT = iphoneos;
434 | VALIDATE_PRODUCT = YES;
435 | };
436 | name = Release;
437 | };
438 | 7B1D08C31E8CFC24005E841A /* Debug */ = {
439 | isa = XCBuildConfiguration;
440 | buildSettings = {
441 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
442 | INFOPLIST_FILE = ZTLetterIndexDemo/Info.plist;
443 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
444 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
445 | PRODUCT_BUNDLE_IDENTIFIER = com.zt.ZTLetterIndexDemo;
446 | PRODUCT_NAME = "$(TARGET_NAME)";
447 | };
448 | name = Debug;
449 | };
450 | 7B1D08C41E8CFC24005E841A /* Release */ = {
451 | isa = XCBuildConfiguration;
452 | buildSettings = {
453 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
454 | INFOPLIST_FILE = ZTLetterIndexDemo/Info.plist;
455 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
456 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
457 | PRODUCT_BUNDLE_IDENTIFIER = com.zt.ZTLetterIndexDemo;
458 | PRODUCT_NAME = "$(TARGET_NAME)";
459 | };
460 | name = Release;
461 | };
462 | 7B1D08C61E8CFC24005E841A /* Debug */ = {
463 | isa = XCBuildConfiguration;
464 | buildSettings = {
465 | BUNDLE_LOADER = "$(TEST_HOST)";
466 | INFOPLIST_FILE = ZTLetterIndexDemoTests/Info.plist;
467 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
468 | PRODUCT_BUNDLE_IDENTIFIER = com.zt.ZTLetterIndexDemoTests;
469 | PRODUCT_NAME = "$(TARGET_NAME)";
470 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZTLetterIndexDemo.app/ZTLetterIndexDemo";
471 | };
472 | name = Debug;
473 | };
474 | 7B1D08C71E8CFC24005E841A /* Release */ = {
475 | isa = XCBuildConfiguration;
476 | buildSettings = {
477 | BUNDLE_LOADER = "$(TEST_HOST)";
478 | INFOPLIST_FILE = ZTLetterIndexDemoTests/Info.plist;
479 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
480 | PRODUCT_BUNDLE_IDENTIFIER = com.zt.ZTLetterIndexDemoTests;
481 | PRODUCT_NAME = "$(TARGET_NAME)";
482 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ZTLetterIndexDemo.app/ZTLetterIndexDemo";
483 | };
484 | name = Release;
485 | };
486 | 7B1D08C91E8CFC24005E841A /* Debug */ = {
487 | isa = XCBuildConfiguration;
488 | buildSettings = {
489 | INFOPLIST_FILE = ZTLetterIndexDemoUITests/Info.plist;
490 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
491 | PRODUCT_BUNDLE_IDENTIFIER = com.zt.ZTLetterIndexDemoUITests;
492 | PRODUCT_NAME = "$(TARGET_NAME)";
493 | TEST_TARGET_NAME = ZTLetterIndexDemo;
494 | };
495 | name = Debug;
496 | };
497 | 7B1D08CA1E8CFC24005E841A /* Release */ = {
498 | isa = XCBuildConfiguration;
499 | buildSettings = {
500 | INFOPLIST_FILE = ZTLetterIndexDemoUITests/Info.plist;
501 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
502 | PRODUCT_BUNDLE_IDENTIFIER = com.zt.ZTLetterIndexDemoUITests;
503 | PRODUCT_NAME = "$(TARGET_NAME)";
504 | TEST_TARGET_NAME = ZTLetterIndexDemo;
505 | };
506 | name = Release;
507 | };
508 | /* End XCBuildConfiguration section */
509 |
510 | /* Begin XCConfigurationList section */
511 | 7B1D08901E8CFC24005E841A /* Build configuration list for PBXProject "ZTLetterIndexDemo" */ = {
512 | isa = XCConfigurationList;
513 | buildConfigurations = (
514 | 7B1D08C01E8CFC24005E841A /* Debug */,
515 | 7B1D08C11E8CFC24005E841A /* Release */,
516 | );
517 | defaultConfigurationIsVisible = 0;
518 | defaultConfigurationName = Release;
519 | };
520 | 7B1D08C21E8CFC24005E841A /* Build configuration list for PBXNativeTarget "ZTLetterIndexDemo" */ = {
521 | isa = XCConfigurationList;
522 | buildConfigurations = (
523 | 7B1D08C31E8CFC24005E841A /* Debug */,
524 | 7B1D08C41E8CFC24005E841A /* Release */,
525 | );
526 | defaultConfigurationIsVisible = 0;
527 | defaultConfigurationName = Release;
528 | };
529 | 7B1D08C51E8CFC24005E841A /* Build configuration list for PBXNativeTarget "ZTLetterIndexDemoTests" */ = {
530 | isa = XCConfigurationList;
531 | buildConfigurations = (
532 | 7B1D08C61E8CFC24005E841A /* Debug */,
533 | 7B1D08C71E8CFC24005E841A /* Release */,
534 | );
535 | defaultConfigurationIsVisible = 0;
536 | defaultConfigurationName = Release;
537 | };
538 | 7B1D08C81E8CFC24005E841A /* Build configuration list for PBXNativeTarget "ZTLetterIndexDemoUITests" */ = {
539 | isa = XCConfigurationList;
540 | buildConfigurations = (
541 | 7B1D08C91E8CFC24005E841A /* Debug */,
542 | 7B1D08CA1E8CFC24005E841A /* Release */,
543 | );
544 | defaultConfigurationIsVisible = 0;
545 | defaultConfigurationName = Release;
546 | };
547 | /* End XCConfigurationList section */
548 | };
549 | rootObject = 7B1D088D1E8CFC24005E841A /* Project object */;
550 | }
551 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ZTLetterIndexDemo
4 | //
5 | // Created by 赵天福 on 2017/3/30.
6 | // Copyright © 2017年 zt. 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 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // ZTLetterIndexDemo
4 | //
5 | // Created by 赵天福 on 2017/3/30.
6 | // Copyright © 2017年 zt. 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 |
24 | - (void)applicationWillResignActive:(UIApplication *)application {
25 | // 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.
26 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
27 | }
28 |
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application {
31 | // 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.
32 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
33 | }
34 |
35 |
36 | - (void)applicationWillEnterForeground:(UIApplication *)application {
37 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
38 | }
39 |
40 |
41 | - (void)applicationDidBecomeActive:(UIApplication *)application {
42 | // 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.
43 | }
44 |
45 |
46 | - (void)applicationWillTerminate:(UIApplication *)application {
47 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
48 | }
49 |
50 |
51 | @end
52 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/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 | }
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/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 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/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 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/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 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // ZTLetterIndexDemo
4 | //
5 | // Created by 赵天福 on 2017/3/30.
6 | // Copyright © 2017年 zt. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 |
13 |
14 | @end
15 |
16 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // ZTLetterIndexDemo
4 | //
5 | // Created by 赵天福 on 2017/3/30.
6 | // Copyright © 2017年 zt. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "ZTLetterIndex.h"
11 |
12 | #define kScreenWidth ([[UIScreen mainScreen]bounds].size.width)
13 | #define kScreenHeight ([[UIScreen mainScreen]bounds].size.height)
14 |
15 |
16 | @interface ViewController ()
17 | {
18 | NSMutableArray *_dataSource;
19 | NSMutableArray *_letterArray;
20 | ZTLetterIndex *_letterIndex;
21 | BOOL _isClick;
22 | }
23 |
24 | @property (weak, nonatomic) IBOutlet UITableView *tableView;
25 |
26 | @end
27 |
28 | @implementation ViewController
29 |
30 | - (void)viewDidLoad {
31 | [super viewDidLoad];
32 |
33 | _isClick = NO;
34 | _dataSource = [NSMutableArray array];
35 | for (int i = 0; i < 26; ++i) {
36 | NSMutableArray *temp = [NSMutableArray array];
37 | for (int i = 0; i < arc4random()%5+3; ++i) {
38 | [temp addObject:[NSString stringWithFormat:@"%d",arc4random()%10000]];
39 | }
40 | [_dataSource addObject:temp];
41 | }
42 |
43 | _letterArray = [NSMutableArray array];
44 | for (char c='A';c<='Z';c++) {
45 | [_letterArray addObject:[NSString stringWithFormat:@"%c",c]];
46 | }
47 |
48 | _letterIndex = [[ZTLetterIndex alloc] initWithFrame:CGRectMake(kScreenWidth-20, (kScreenHeight - 16*25 - 40)/2, 12, 16*25 + 40 + 8)];
49 | _letterIndex.dataArray = _letterArray; //在其他用于展示的属性赋值之后赋值
50 | _letterIndex.delegate = self;
51 | [self.view addSubview:_letterIndex];
52 | }
53 |
54 | #pragma mark - ZTLetterIndexDelegate
55 | - (void)ZTLetterIndex:(ZTLetterIndex *)indexView didSelectedItemWithIndex:(NSInteger)index
56 | {
57 | _isClick = YES;
58 | [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index] atScrollPosition:UITableViewScrollPositionTop animated:NO];
59 | }
60 |
61 | - (void)ZTLetterIndex:(ZTLetterIndex *)indexView beginChangeItemWithIndex:(NSInteger)index
62 | {
63 | [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index] atScrollPosition:UITableViewScrollPositionTop animated:NO];
64 | }
65 |
66 | - (void)ZTLetterIndex:(ZTLetterIndex *)indexView endChangeItemWithIndex:(NSInteger)index
67 | {
68 | [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index] atScrollPosition:UITableViewScrollPositionTop animated:NO];
69 | }
70 |
71 | - (void)ZTLetterIndex:(ZTLetterIndex *)indexView isChangingItemWithIndex:(NSInteger)index
72 | {
73 | [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index] atScrollPosition:UITableViewScrollPositionTop animated:NO];
74 | }
75 |
76 | #pragma mark - UITableViewDelegate&DateSource
77 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
78 | {
79 | static NSString *identifier = @"Cell";
80 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
81 | if (!cell) {
82 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
83 | }
84 | cell.textLabel.text = _dataSource[indexPath.section][indexPath.row];
85 |
86 | return cell;
87 | }
88 |
89 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
90 | {
91 | return _letterArray[section];
92 | }
93 |
94 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
95 | {
96 | return _dataSource.count;
97 | }
98 |
99 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
100 | {
101 | return [_dataSource[section] count];
102 | }
103 |
104 | #pragma mark -UIScrollViewDelegate
105 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView
106 | {
107 | if (_isClick) {
108 | return;
109 | }
110 | NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:scrollView.contentOffset];
111 | [_letterIndex selectIndex:indexPath.section];
112 | }
113 | -(void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
114 | _isClick = NO;
115 | }
116 |
117 | @end
118 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemo/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ZTLetterIndexDemo
4 | //
5 | // Created by 赵天福 on 2017/3/30.
6 | // Copyright © 2017年 zt. 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 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemoTests/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 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemoTests/ZTLetterIndexDemoTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZTLetterIndexDemoTests.m
3 | // ZTLetterIndexDemoTests
4 | //
5 | // Created by 赵天福 on 2017/3/30.
6 | // Copyright © 2017年 zt. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ZTLetterIndexDemoTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation ZTLetterIndexDemoTests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 | // Put setup code here. This method is called before the invocation of each test method in the class.
20 | }
21 |
22 | - (void)tearDown {
23 | // Put teardown code here. This method is called after the invocation of each test method in the class.
24 | [super tearDown];
25 | }
26 |
27 | - (void)testExample {
28 | // This is an example of a functional test case.
29 | // Use XCTAssert and related functions to verify your tests produce the correct results.
30 | }
31 |
32 | - (void)testPerformanceExample {
33 | // This is an example of a performance test case.
34 | [self measureBlock:^{
35 | // Put the code you want to measure the time of here.
36 | }];
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemoUITests/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 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/ZTLetterIndexDemo/ZTLetterIndexDemoUITests/ZTLetterIndexDemoUITests.m:
--------------------------------------------------------------------------------
1 | //
2 | // ZTLetterIndexDemoUITests.m
3 | // ZTLetterIndexDemoUITests
4 | //
5 | // Created by 赵天福 on 2017/3/30.
6 | // Copyright © 2017年 zt. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ZTLetterIndexDemoUITests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation ZTLetterIndexDemoUITests
16 |
17 | - (void)setUp {
18 | [super setUp];
19 |
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 |
22 | // In UI tests it is usually best to stop immediately when a failure occurs.
23 | self.continueAfterFailure = NO;
24 | // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method.
25 | [[[XCUIApplication alloc] init] launch];
26 |
27 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
28 | }
29 |
30 | - (void)tearDown {
31 | // Put teardown code here. This method is called after the invocation of each test method in the class.
32 | [super tearDown];
33 | }
34 |
35 | - (void)testExample {
36 | // Use recording to get started writing UI tests.
37 | // Use XCTAssert and related functions to verify your tests produce the correct results.
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------