├── Contacts
├── Resources
│ ├── note_bg.png
│ ├── touxiang1.png
│ ├── touxiang2.png
│ ├── recomends.json
│ └── contacts1.json
├── Classes
│ ├── PinYin
│ │ ├── ChineseInclude.h
│ │ ├── PinYinForObjc.h
│ │ ├── ChineseInclude.m
│ │ ├── PinyinFormatter.h
│ │ ├── HanyuPinyinOutputFormat.m
│ │ ├── ChineseToPinyinResource.h
│ │ ├── HanyuPinyinOutputFormat.h
│ │ ├── NSString+PinYin4Cocoa.h
│ │ ├── PinYinForObjc.m
│ │ ├── PinyinHelper.h
│ │ ├── ChineseToPinyinResource.m
│ │ ├── PinyinHelper.m
│ │ ├── NSString+PinYin4Cocoa.m
│ │ └── PinyinFormatter.m
│ ├── ABContacts
│ │ ├── ABAddressBook.m
│ │ ├── Base
│ │ │ ├── UIImage+TKUtilities.h
│ │ │ ├── NSString+TKUtilities.h
│ │ │ ├── NSString+TKUtilities.m
│ │ │ └── UIImage+TKUtilities.m
│ │ ├── ABAddressBook.h
│ │ ├── AddressBookViewController.h
│ │ ├── AddressBookViewController.xib
│ │ └── AddressBookViewController.m
│ ├── ContactDetail
│ │ ├── ContactHeadCell.h
│ │ ├── ContactSchoolInfoCell.h
│ │ ├── ContactPersonInfoCell.h
│ │ ├── ContactDetailTableViewController.h
│ │ ├── ContactDetailViewController.h
│ │ ├── ContactDetailCell.h
│ │ ├── ContactDetailCell.m
│ │ ├── ContactHeadCell.m
│ │ ├── ContactDetailViewController.m
│ │ ├── ContactDetailSection.h
│ │ ├── ContactSchoolInfoCell.m
│ │ ├── ContactPersonInfoCell.m
│ │ ├── ContactDetailTableViewController.m
│ │ └── ContactDetailSection.m
│ ├── ContactsView
│ │ ├── ContactCell.m
│ │ ├── ContactCell.h
│ │ ├── ViewController.h
│ │ ├── Contacts.h
│ │ ├── ContactsTableView.h
│ │ ├── Contacts.m
│ │ ├── ContactsTableViewIndex.h
│ │ ├── ContactCell.xib
│ │ ├── ContactsTableView.m
│ │ ├── ContactsTableViewIndex.m
│ │ └── ViewController.m
│ └── AddContact
│ │ ├── RecomendsCell.m
│ │ ├── RecomendsCell.h
│ │ ├── AddContactsViewController.h
│ │ ├── AddContactsViewController.xib
│ │ ├── RecomendsCell.xib
│ │ └── AddContactsViewController.m
├── AppDelegate.h
├── main.m
├── Images.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── Base.lproj
│ ├── Main.storyboard
│ └── LaunchScreen.xib
└── AppDelegate.m
├── README.md
├── Contacts.xcodeproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── emma.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
├── xcuserdata
│ └── emma.xcuserdatad
│ │ ├── xcschemes
│ │ ├── xcschememanagement.plist
│ │ └── Contacts.xcscheme
│ │ └── xcdebugger
│ │ └── Breakpoints_v2.xcbkptlist
└── project.pbxproj
└── ContactsTests
├── ContactsPrefixHeader.pch
├── Info.plist
└── ContactsTests.m
/Contacts/Resources/note_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EmmaKong/Contacts/HEAD/Contacts/Resources/note_bg.png
--------------------------------------------------------------------------------
/Contacts/Resources/touxiang1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EmmaKong/Contacts/HEAD/Contacts/Resources/touxiang1.png
--------------------------------------------------------------------------------
/Contacts/Resources/touxiang2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EmmaKong/Contacts/HEAD/Contacts/Resources/touxiang2.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Contacts
2 | 仿微信通讯录,
3 | 通讯录朋友按名字首字母索引排序,
4 | 可实现添加朋友,
5 | 访问本地通讯录,并添加通讯录朋友
6 |
7 | # 其他
8 | 可进行联系人姓名搜索,支持中文和拼音搜索
9 | 利用NotificationCenter,实现不同的视图控制器之间的参数传递
10 |
--------------------------------------------------------------------------------
/Contacts.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Contacts.xcodeproj/project.xcworkspace/xcuserdata/emma.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EmmaKong/Contacts/HEAD/Contacts.xcodeproj/project.xcworkspace/xcuserdata/emma.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/ChineseInclude.h:
--------------------------------------------------------------------------------
1 | //
2 | // ChineseInclude.h
3 | // Search
4 | //
5 | // Created by LYZ on 14-1-24.
6 | // Copyright (c) 2014年 LYZ. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ChineseInclude : NSObject
12 | + (BOOL)isIncludeChineseInString:(NSString*)str;
13 | @end
14 |
--------------------------------------------------------------------------------
/Contacts/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. 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 |
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/ABAddressBook.m:
--------------------------------------------------------------------------------
1 | //
2 | // ABAddressBook.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/25.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ABAddressBook.h"
10 |
11 | @implementation ABAddressBook
12 | @synthesize name, email, tel, thumbnail, recordID, sectionNumber, rowSelected;
13 |
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Contacts/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. 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 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactHeadCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactHeadCell.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 | #import
9 | #import "ContactDetailCell.h"
10 | #import "Contacts.h"
11 |
12 | @interface ContactHeadCell : ContactDetailCell
13 |
14 | - (instancetype)init:(Contacts*)contact;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactSchoolInfoCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactSchoolInfoCell.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactDetailCell.h"
10 | #import "Contacts.h"
11 |
12 | @interface ContactSchoolInfoCell : ContactDetailCell
13 |
14 | - (instancetype)init:(Contacts*)contact;
15 |
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/Base/UIImage+TKUtilities.h:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+TKUtilities.h
3 | // TKContactsMultiPicker
4 | //
5 | // Created by Jongtae Ahn on 12. 8. 31..
6 | // Copyright (c) 2012년 TABKO Inc. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface UIImage (TKUtilities)
13 |
14 | - (UIImage*)thumbnailImage:(CGSize)targetSize;
15 |
16 | @end
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactPersonInfoCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactPersonInfoCell.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ContactDetailCell.h"
11 | #import "Contacts.h"
12 |
13 | @interface ContactPersonInfoCell : ContactDetailCell
14 |
15 | - (instancetype)init:(Contacts*)contact;
16 | @end
17 |
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/Base/NSString+TKUtilities.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+TKUtilities.h
3 | // TKContactsMultiPicker
4 | //
5 | // Created by 종태 안 on 12. 5. 17..
6 | // Copyright (c) 2012년 Tabko Inc. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSString (TKUtilities)
12 |
13 | - (BOOL)containsString:(NSString *)aString;
14 | - (NSString*)initTelephoneWithReformat;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactDetailTableViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactDetailTableViewController.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ContactDetailSection.h"
11 | #import "ContactDetailCell.h"
12 |
13 |
14 | @interface ContactDetailTableViewController : UITableViewController
15 |
16 | @property (nonatomic, strong) NSArray *sections;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/PinYinForObjc.h:
--------------------------------------------------------------------------------
1 | //
2 | // PinYinForObjc.h
3 | // Search
4 | //
5 | // Created by LYZ on 14-1-24.
6 | // Copyright (c) 2014年 LYZ. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "HanyuPinyinOutputFormat.h"
11 | #import "PinyinHelper.h"
12 |
13 | @interface PinYinForObjc : NSObject
14 |
15 | + (NSString*)chineseConvertToPinYin:(NSString*)chinese;//转换为拼音
16 | + (NSString*)chineseConvertToPinYinHead:(NSString *)chinese;//转换为拼音首字母
17 | @end
18 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactDetailViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactDetailViewController.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "Contacts.h"
11 | #import "ContactDetailTableViewController.h"
12 |
13 | @interface ContactDetailViewController : ContactDetailTableViewController
14 |
15 |
16 |
17 | @property (nonatomic,retain) Contacts *contact;
18 |
19 |
20 |
21 | @end
22 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/ContactCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactCell.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactCell.h"
10 |
11 | @implementation ContactCell
12 |
13 | - (void)awakeFromNib {
14 | // Initialization code
15 | }
16 |
17 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
18 | [super setSelected:selected animated:animated];
19 |
20 | // Configure the view for the selected state
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Contacts/Resources/recomends.json:
--------------------------------------------------------------------------------
1 | [
2 | {"name":"hehe"},
3 | {"name":"好后"},
4 | {"name":"小李"},
5 | {"name":"恩恩"},
6 | {"name":"阿福送给那个"},
7 | {"name":"1234"},
8 | {"name":"把辐射微博共同"},
9 | {"name":"KKKK"},
10 | {"name":"龙凤的给推荐"},
11 | {"name":"imgwh"},
12 | {"name":"wert"},
13 | {"name":"aswarh"},
14 | {"name":"悠悠"},
15 | {"name":"VVV"},
16 | {"name":"对莫高窟天天让你回头"},
17 | {"name":"记得那个软件同步"},
18 | {"name":"阿妹"},
19 | {"name":"节节"},
20 | {"name":"问耳机高"},
21 | {"name":"哦日么"},
22 | {"name":"可么认可"},
23 | {"name":"阿情况,哦来看看海"},
24 | {"name":"不是富人吧"}
25 | ]
--------------------------------------------------------------------------------
/Contacts/Classes/AddContact/RecomendsCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // RecomendsCell.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/19.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "RecomendsCell.h"
10 |
11 | @implementation RecomendsCell
12 |
13 | - (void)awakeFromNib {
14 | // Initialization code
15 | }
16 |
17 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
18 | [super setSelected:selected animated:animated];
19 |
20 | // Configure the view for the selected state
21 | }
22 |
23 | @end
24 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactDetailCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactDetailCell.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ContactDetailCell : UITableViewCell
12 |
13 | @property (nonatomic) CGFloat height;
14 | @property (nonatomic, copy) dispatch_block_t actionBlock;
15 |
16 | + (instancetype)cellWithStyle:(UITableViewCellStyle)style height:(CGFloat)height actionBlock:(dispatch_block_t)actionBlock;
17 |
18 | @end
19 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/ChineseInclude.m:
--------------------------------------------------------------------------------
1 | //
2 | // ChineseInclude.m
3 | // Search
4 | //
5 | // Created by LYZ on 14-1-24.
6 | // Copyright (c) 2014年 LYZ. All rights reserved.
7 | //
8 |
9 | #import "ChineseInclude.h"
10 |
11 | @implementation ChineseInclude
12 |
13 | + (BOOL)isIncludeChineseInString:(NSString*)str {
14 | for (int i=0; i
10 |
11 | @protocol ContactCellDelegate
12 |
13 |
14 | @end
15 |
16 |
17 | @interface ContactCell : UITableViewCell
18 |
19 | @property (retain, nonatomic) IBOutlet UILabel *nameLabel;
20 | @property (retain, nonatomic) IBOutlet UIImage *headImage;
21 |
22 | @property (assign, nonatomic) id delegate;
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/PinyinFormatter.h:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | // Created by kimziv on 13-9-14.
5 | //
6 |
7 | #ifndef _PinyinFormatter_H_
8 | #define _PinyinFormatter_H_
9 |
10 | @class HanyuPinyinOutputFormat;
11 |
12 | @interface PinyinFormatter : NSObject {
13 | }
14 |
15 | + (NSString *)formatHanyuPinyinWithNSString:(NSString *)pinyinStr
16 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat;
17 | + (NSString *)convertToneNumber2ToneMarkWithNSString:(NSString *)pinyinStr;
18 | - (id)init;
19 | @end
20 |
21 | #endif // _PinyinFormatter_H_
22 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ContactCell.h"
11 |
12 | @interface ViewController : UIViewController
13 | {
14 |
15 | NSMutableArray *searchResults;
16 | UISearchBar *contactsSearchBar;
17 | UISearchDisplayController *searchDisplayController;
18 |
19 | }
20 |
21 |
22 | @end
23 |
24 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/HanyuPinyinOutputFormat.m:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | // Created by kimziv on 13-9-14.
5 | //
6 |
7 | #include "HanyuPinyinOutputFormat.h"
8 |
9 | @implementation HanyuPinyinOutputFormat
10 | @synthesize vCharType=_vCharType;
11 | @synthesize caseType=_caseType;
12 | @synthesize toneType=_toneType;
13 |
14 | - (id)init {
15 | if (self = [super init]) {
16 | [self restoreDefault];
17 | }
18 | return self;
19 | }
20 |
21 | - (void)restoreDefault {
22 | _vCharType = VCharTypeWithUAndColon;
23 | _caseType = CaseTypeLowercase;
24 | _toneType = ToneTypeWithToneNumber;
25 | }
26 |
27 | @end
28 |
--------------------------------------------------------------------------------
/Contacts/Classes/AddContact/RecomendsCell.h:
--------------------------------------------------------------------------------
1 | //
2 | // RecomendsCell.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/19.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol RecomendsCellDelegate
12 |
13 | @end
14 |
15 | @interface RecomendsCell : UITableViewCell
16 |
17 |
18 | @property (retain, nonatomic) IBOutlet UILabel *nameLabel;
19 | @property (retain, nonatomic) IBOutlet UILabel *addressLabel;
20 | @property (retain, nonatomic) IBOutlet UIImage *headImage;
21 |
22 |
23 | @property (assign, nonatomic) id delegate;
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/Contacts.h:
--------------------------------------------------------------------------------
1 | //
2 | // Contacts.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface Contacts : NSObject
13 |
14 | @property (nonatomic, copy) NSString *name;
15 | @property (nonatomic, copy) UIImage *headimage;
16 | @property (nonatomic, copy) NSString *address;
17 | @property (nonatomic, copy) NSString *detail;
18 | @property NSInteger sectionNumber; // Index
19 |
20 |
21 | - (id)initWithPropertiesDictionary:(NSDictionary *)dic;
22 |
23 |
24 | @end
25 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/ContactsTableView.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactsTableView.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol ContactsTableViewDelegate;
12 |
13 |
14 |
15 | @interface ContactsTableView : UIView
16 |
17 | @property (nonatomic, strong) UITableView * tableView;
18 | @property (nonatomic, strong) id delegate;
19 | - (void)reloadData;
20 |
21 |
22 | @end
23 |
24 | @protocol ContactsTableViewDelegate
25 |
26 | - (NSArray *)sectionIndexTitlesForABELTableView:(ContactsTableView *)tableView;
27 |
28 |
29 | @end
--------------------------------------------------------------------------------
/ContactsTests/ContactsPrefixHeader.pch:
--------------------------------------------------------------------------------
1 | //
2 | // ContactsPrefixHeader.pch
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #ifndef Contacts_ContactsPrefixHeader_pch
12 | #define Contacts_ContactsPrefixHeader_pch
13 |
14 | // Include any system framework and library headers here that should be included in all compilation units.
15 | // You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
16 |
17 | #endif
18 |
19 | #ifdef __OBJC__
20 | #import
21 | #import
22 | #import "UIView-Extended.h"
23 | #endif
24 |
25 |
26 | #define ARC_ENABLED
--------------------------------------------------------------------------------
/Contacts.xcodeproj/xcuserdata/emma.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | Contacts.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | B59715E61B32B6E8006DCCA9
16 |
17 | primary
18 |
19 |
20 | B59715FF1B32B6E8006DCCA9
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Contacts/Images.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 | }
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/ABAddressBook.h:
--------------------------------------------------------------------------------
1 | //
2 | // ABAddressBook.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/25.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ABAddressBook : NSObject {
13 | NSInteger sectionNumber;
14 | NSInteger recordID;
15 | BOOL rowSelected;
16 | NSString *name;
17 | NSString *email;
18 | NSString *tel;
19 | UIImage *thumbnail;
20 | }
21 |
22 | @property NSInteger sectionNumber;
23 | @property NSInteger recordID;
24 | @property BOOL rowSelected;
25 | @property (nonatomic, retain) NSString *name;
26 | @property (nonatomic, retain) NSString *email;
27 | @property (nonatomic, retain) NSString *tel;
28 | @property (nonatomic, retain) UIImage *thumbnail;
29 |
30 | @end
--------------------------------------------------------------------------------
/ContactsTests/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | Emma.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/ChineseToPinyinResource.h:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | // Created by kimziv on 13-9-14.
5 | //
6 |
7 | #include
8 | #ifndef _ChineseToPinyinResource_H_
9 | #define _ChineseToPinyinResource_H_
10 |
11 | @class NSArray;
12 | @class NSMutableDictionary;
13 |
14 | @interface ChineseToPinyinResource : NSObject {
15 | NSString* _directory;
16 | NSDictionary *_unicodeToHanyuPinyinTable;
17 | }
18 | //@property(nonatomic, strong)NSDictionary *unicodeToHanyuPinyinTable;
19 |
20 | - (id)init;
21 | - (void)initializeResource;
22 | - (NSArray *)getHanyuPinyinStringArrayWithChar:(unichar)ch;
23 | - (BOOL)isValidRecordWithNSString:(NSString *)record;
24 | - (NSString *)getHanyuPinyinRecordFromCharWithChar:(unichar)ch;
25 | + (ChineseToPinyinResource *)getInstance;
26 |
27 | @end
28 |
29 |
30 |
31 | #endif // _ChineseToPinyinResource_H_
32 |
--------------------------------------------------------------------------------
/Contacts/Classes/AddContact/AddContactsViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // AddContactsViewController.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "Contacts.h"
11 | #import "RecomendsCell.h"
12 | #import "AddressBookViewController.h"
13 |
14 | @interface AddContactsViewController : UIViewController
15 | {
16 | NSMutableArray *newsearchResults;
17 | UISearchDisplayController *newsearchDisplayController;
18 |
19 | UISearchBar *newcontactsSearchBar;
20 |
21 | }
22 |
23 |
24 | @property (weak, nonatomic) IBOutlet UITableView *recomended;
25 |
26 | @property (nonatomic, retain) NSMutableArray *recomendsArray;
27 |
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/HanyuPinyinOutputFormat.h:
--------------------------------------------------------------------------------
1 | /**
2 | * Created by kimziv on 13-9-14.
3 | */
4 | #include
5 | #ifndef _HanyuPinyinOutputFormat_H_
6 | #define _HanyuPinyinOutputFormat_H_
7 |
8 | typedef enum {
9 | ToneTypeWithToneNumber,
10 | ToneTypeWithoutTone,
11 | ToneTypeWithToneMark
12 | }ToneType;
13 |
14 | typedef enum {
15 | CaseTypeUppercase,
16 | CaseTypeLowercase
17 | }CaseType;
18 |
19 | typedef enum {
20 | VCharTypeWithUAndColon,
21 | VCharTypeWithV,
22 | VCharTypeWithUUnicode
23 | }VCharType;
24 |
25 |
26 | @interface HanyuPinyinOutputFormat : NSObject
27 |
28 | @property(nonatomic, assign) VCharType vCharType;
29 | @property(nonatomic, assign) CaseType caseType;
30 | @property(nonatomic, assign) ToneType toneType;
31 |
32 | - (id)init;
33 | - (void)restoreDefault;
34 | @end
35 |
36 | #endif // _HanyuPinyinOutputFormat_H_
37 |
--------------------------------------------------------------------------------
/ContactsTests/ContactsTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactsTests.m
3 | // ContactsTests
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @interface ContactsTests : XCTestCase
13 |
14 | @end
15 |
16 | @implementation ContactsTests
17 |
18 | - (void)setUp {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown {
24 | // Put teardown code here. This method is called after the invocation of each test method in the class.
25 | [super tearDown];
26 | }
27 |
28 | - (void)testExample {
29 | // This is an example of a functional test case.
30 | XCTAssert(YES, @"Pass");
31 | }
32 |
33 | - (void)testPerformanceExample {
34 | // This is an example of a performance test case.
35 | [self measureBlock:^{
36 | // Put the code you want to measure the time of here.
37 | }];
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactDetailCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactDetailCell.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactDetailCell.h"
10 | #import
11 |
12 | @implementation ContactDetailCell
13 |
14 | + (instancetype)cellWithStyle:(UITableViewCellStyle)style height:(CGFloat)height actionBlock:(dispatch_block_t)actionBlock {
15 | ContactDetailCell *cell = [[[self class] alloc] initWithStyle:style reuseIdentifier:nil];
16 | cell.height = height;
17 | cell.actionBlock = actionBlock ?: ^{};
18 | return cell;
19 | }
20 |
21 | - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
22 | self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
23 |
24 | if (!self) {
25 | return nil;
26 | }
27 |
28 | self.height = UITableViewAutomaticDimension;
29 | self.actionBlock = ^{};
30 |
31 | return self;
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/Contacts.m:
--------------------------------------------------------------------------------
1 | //
2 | // Contacts.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "Contacts.h"
10 |
11 | @implementation Contacts
12 |
13 | - (id)initWithPropertiesDictionary:(NSDictionary *)dic
14 | {
15 | self = [super init];
16 | if (self) {
17 | if (dic != nil) {
18 | self.name = [dic objectForKey:@"name"];
19 | self.headimage = [dic objectForKey:@"headimage"];
20 | self.address = [dic objectForKey:@"address"];
21 | self.detail = [dic objectForKey:@"detail"];
22 |
23 | }
24 | }
25 |
26 | return self;
27 | }
28 |
29 | - (NSString *)description
30 | {
31 | NSString *result = @"";
32 | result = [result stringByAppendingFormat:@"name : %@\n",self.name];
33 | result = [result stringByAppendingFormat:@"headimage : %@\n",self.headimage];
34 | result = [result stringByAppendingFormat:@"address : %@\n",self.address];
35 | result = [result stringByAppendingFormat:@"detail: %@\n",self.detail];
36 | return result;
37 | }
38 |
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/Base/NSString+TKUtilities.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+TKUtilities.m
3 | // TKContactsMultiPicker
4 | //
5 | // Created by Jongtae Ahn on 12. 8. 31..
6 | // Copyright (c) 2012년 TABKO Inc. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "NSString+TKUtilities.h"
11 |
12 | @implementation NSString (TKUtilities)
13 |
14 | - (BOOL)containsString:(NSString *)aString
15 | {
16 | NSRange range = [[self lowercaseString] rangeOfString:[aString lowercaseString]];
17 | return range.location != NSNotFound;
18 | }
19 |
20 | - (NSString*)initTelephoneWithReformat
21 | {
22 |
23 | if ([self containsString:@"-"])
24 | {
25 | self = [self stringByReplacingOccurrencesOfString:@"-" withString:@""];
26 | }
27 |
28 | if ([self containsString:@" "])
29 | {
30 | self = [self stringByReplacingOccurrencesOfString:@" " withString:@""];
31 | }
32 |
33 | if ([self containsString:@"("])
34 | {
35 | self = [self stringByReplacingOccurrencesOfString:@"(" withString:@""];
36 | }
37 |
38 | if ([self containsString:@")"])
39 | {
40 | self = [self stringByReplacingOccurrencesOfString:@")" withString:@""];
41 | }
42 |
43 | return self;
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/AddressBookViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // AddressBookViewController.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/25.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 | #import
13 | #import
14 | #import "ABAddressBook.h"
15 |
16 | @class ABAddressBook, AddressBookViewController;
17 | @protocol AddressBookViewControllerDelegate
18 | @required
19 |
20 |
21 | @end
22 |
23 |
24 | @interface AddressBookViewController : UIViewController
25 | {
26 | id _delegate;
27 |
28 | NSUInteger _selectedCount;
29 | NSMutableArray *_listContent; // 本地通讯录数据
30 | NSMutableArray *_filteredListContent; // search result 数据
31 | UISearchBar *ABsearchBar;
32 | UISearchDisplayController *ABsearchDisplayController;
33 |
34 | }
35 |
36 | @property (nonatomic, retain) id delegate;
37 | @property (nonatomic, retain) IBOutlet UITableView *tableView;
38 |
39 | @property (nonatomic, copy) NSString *savedSearchTerm;
40 | @property (nonatomic) NSInteger savedScopeButtonIndex;
41 | @property (nonatomic) BOOL searchWasActive;
42 |
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/NSString+PinYin4Cocoa.h:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+PinYin4Cocoa.h
3 | // PinYin4Cocoa
4 | //
5 | // Created by kimziv on 13-9-15.
6 | // Copyright (c) 2013年 kimziv. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface NSString (PinYin4Cocoa)
12 |
13 | - (NSInteger)indexOfString:(NSString *)s;
14 | - (NSInteger)indexOfString:(NSString *)s fromIndex:(int)index;
15 | - (NSInteger)indexOf:(int)ch;
16 | - (NSInteger)indexOf:(int)ch fromIndex:(int)index;
17 | + (NSString *)valueOfChar:(unichar)value;
18 |
19 | -(NSString *) stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement;
20 | -(NSString *) stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement caseInsensitive:(BOOL) ignoreCase;
21 | -(NSString *) stringByReplacingRegexPattern:(NSString *)regex withString:(NSString *) replacement caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine;
22 | -(NSArray *) stringsByExtractingGroupsUsingRegexPattern:(NSString *)regex;
23 | -(NSArray *) stringsByExtractingGroupsUsingRegexPattern:(NSString *)regex caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine;
24 | -(BOOL) matchesPatternRegexPattern:(NSString *)regex;
25 | -(BOOL) matchesPatternRegexPattern:(NSString *)regex caseInsensitive:(BOOL) ignoreCase treatAsOneLine:(BOOL) assumeMultiLine;
26 | @end
27 |
--------------------------------------------------------------------------------
/Contacts/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | Emma.$(PRODUCT_NAME:rfc1034identifier)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/ContactsTableViewIndex.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactsTableViewIndex.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @protocol ContactsTableViewIndexDelegate;
12 |
13 |
14 | @interface ContactsTableViewIndex : UIView
15 |
16 | @property (nonatomic, strong) NSArray *indexes;
17 | @property (nonatomic, weak) id tableViewIndexDelegate;
18 |
19 | @end
20 |
21 | @protocol ContactsTableViewIndexDelegate
22 |
23 | /**
24 | * 触摸到索引时触发
25 | *
26 | * @param tableViewIndex 触发didSelectSectionAtIndex对象
27 | * @param index 索引下标
28 | * @param title 索引文字
29 | */
30 | - (void)tableViewIndex:(ContactsTableViewIndex *)tableViewIndex didSelectSectionAtIndex:(NSInteger)index withTitle:(NSString *)title;
31 |
32 | /**
33 | * 开始触摸索引
34 | *
35 | * @param tableViewIndex 触发tableViewIndexTouchesBegan对象
36 | */
37 | - (void)tableViewIndexTouchesBegan:(ContactsTableViewIndex *)tableViewIndex;
38 | /**
39 | * 触摸索引结束
40 | *
41 | * @param tableViewIndex
42 | */
43 | - (void)tableViewIndexTouchesEnd:(ContactsTableViewIndex *)tableViewIndex;
44 |
45 | /**
46 | * TableView中右边右边索引title
47 | *
48 | * @param tableViewIndex 触发tableViewIndexTitle对象
49 | *
50 | * @return 索引title数组
51 | */
52 | - (NSArray *)tableViewIndexTitle:(ContactsTableViewIndex *)tableViewIndex;
53 |
54 | @end
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/PinYinForObjc.m:
--------------------------------------------------------------------------------
1 | //
2 | // PinYinForObjc.m
3 | // Search
4 | //
5 | // Created by LYZ on 14-1-24.
6 | // Copyright (c) 2014年 LYZ. All rights reserved.
7 | //
8 |
9 | #import "PinYinForObjc.h"
10 |
11 | @implementation PinYinForObjc
12 |
13 | + (NSString*)chineseConvertToPinYin:(NSString*)chinese {
14 | NSString *sourceText = chinese;
15 | HanyuPinyinOutputFormat *outputFormat = [[HanyuPinyinOutputFormat alloc] init];
16 | [outputFormat setToneType:ToneTypeWithoutTone];
17 | [outputFormat setVCharType:VCharTypeWithV];
18 | [outputFormat setCaseType:CaseTypeLowercase];
19 | NSString *outputPinyin = [PinyinHelper toHanyuPinyinStringWithNSString:sourceText withHanyuPinyinOutputFormat:outputFormat withNSString:@""];
20 |
21 | return outputPinyin;
22 |
23 |
24 | }
25 |
26 | + (NSString*)chineseConvertToPinYinHead:(NSString *)chinese {
27 | HanyuPinyinOutputFormat *outputFormat = [[HanyuPinyinOutputFormat alloc] init];
28 | [outputFormat setToneType:ToneTypeWithoutTone];
29 | [outputFormat setVCharType:VCharTypeWithV];
30 | [outputFormat setCaseType:CaseTypeLowercase];
31 | NSMutableString *outputPinyin = [[NSMutableString alloc] init];
32 | for (int i=0;i
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 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/PinyinHelper.h:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | // Created by kimziv on 13-9-14.
5 | //
6 |
7 | #ifndef _PinyinHelper_H_
8 | #define _PinyinHelper_H_
9 |
10 | @class HanyuPinyinOutputFormat;
11 |
12 | @interface PinyinHelper : NSObject {
13 | }
14 |
15 | + (NSArray *)toHanyuPinyinStringArrayWithChar:(unichar)ch;
16 | + (NSArray *)toHanyuPinyinStringArrayWithChar:(unichar)ch
17 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat;
18 | + (NSArray *)getFormattedHanyuPinyinStringArrayWithChar:(unichar)ch
19 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat;
20 | + (NSArray *)getUnformattedHanyuPinyinStringArrayWithChar:(unichar)ch;
21 | + (NSArray *)toTongyongPinyinStringArrayWithChar:(unichar)ch;
22 | + (NSArray *)toWadeGilesPinyinStringArrayWithChar:(unichar)ch;
23 | + (NSArray *)toMPS2PinyinStringArrayWithChar:(unichar)ch;
24 | + (NSArray *)toYalePinyinStringArrayWithChar:(unichar)ch;
25 | + (NSArray *)convertToTargetPinyinStringArrayWithChar:(unichar)ch
26 | withPinyinRomanizationType:(NSString *)targetPinyinSystem;
27 | + (NSArray *)toGwoyeuRomatzyhStringArrayWithChar:(unichar)ch;
28 | + (NSArray *)convertToGwoyeuRomatzyhStringArrayWithChar:(unichar)ch;
29 | + (NSString *)toHanyuPinyinStringWithNSString:(NSString *)str
30 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat
31 | withNSString:(NSString *)seperater;
32 | + (NSString *)getFirstHanyuPinyinStringWithChar:(unichar)ch
33 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat;
34 | - (id)init;
35 | @end
36 |
37 | #endif // _PinyinHelper_H_
38 |
--------------------------------------------------------------------------------
/Contacts/Resources/contacts1.json:
--------------------------------------------------------------------------------
1 | [
2 | {"name":"ada" },
3 | {"name":"alfred"},
4 | {"name":"ain"},
5 | {"name":"aanatahd"},
6 | {"name":"安安"},
7 | {"name":"angle"},
8 | {"name":"bda" },
9 | {"name":"Balfred"},
10 | {"name":"bin"},
11 | {"name":"banatahd"},
12 | {"name":"彬彬"},
13 | {"name":"cda" },
14 | {"name":"clfred"},
15 | {"name":"cain"},
16 | {"name":"canatahd"},
17 | {"name":"才"},
18 | {"name":"cangle"},
19 | {"name":"Dada" },
20 | {"name":"Dalfred"},
21 | {"name":"Dain"},
22 | {"name":"Dd"},
23 | {"name":"dada"},
24 | {"name":"dangle"} ,
25 | {"name":"Eada" },
26 | {"name":"嗯嗯"},
27 | {"name":"恶霸"},
28 | {"name":"engle"},
29 | {"name":"风雨" },
30 | {"name":"fred"},
31 | {"name":"fain"},
32 | {"name":"烦烦"},
33 | {"name":"Fngle"},
34 | {"name":"高" },
35 | {"name":"Flfred"},
36 | {"name":"Fin"},
37 | {"name":"Fanatahd"},
38 | {"name":"防"} ,
39 | {"name":"Hebe" },
40 | {"name":"Hlfred"},
41 | {"name":"很好"},
42 | {"name":"heng"} ,
43 | {"name":"jada" },
44 | {"name":"jfred"},
45 | {"name":"jain"},
46 | {"name":"家家"},
47 | {"name":"江"},
48 | {"name":"jangle"} ,
49 | {"name":"孔" },
50 | {"name":"keng"},
51 | {"name":"可可"},
52 | {"name":"kanatahd"},
53 | {"name":"kngle"} ,
54 | {"name":"刘" },
55 | {"name":"lfred"},
56 | {"name":"lain"},
57 | {"name":"lanatahd"},
58 | {"name":"丽丽"},
59 | {"name":"langle"} ,
60 | {"name":"mada" },
61 | {"name":"malfred"},
62 | {"name":"妈妈"},
63 | {"name":"马力"},
64 | {"name":"Nada" },
65 | {"name":"牛老师"},
66 | {"name":"oada" },
67 | {"name":"欧豪"} ,
68 | {"name":"Prada" },
69 | {"name":"鹏"},
70 | {"name":"瑞子" },
71 | {"name":"red"} ,
72 | {"name":"Sen" },
73 | {"name":"slfred"},
74 | {"name":"森林"} ,
75 | {"name":"婷婷" },
76 | {"name":"提提"},
77 | {"name":"Ti"},
78 | {"name":"tina"},
79 | {"name":"Tin"} ,
80 | {"name":"王" },
81 | {"name":"万"},
82 | {"name":"wan"},
83 | {"name":"wanatahd"},
84 | {"name":"wrong"},
85 | {"name":"wangohfg"} ,
86 | {"name":"小小"},
87 | {"name":"想念"},
88 | {"name":"0000" },
89 | {"name":"123"}
90 | ]
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactHeadCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactHeadCell.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactHeadCell.h"
10 |
11 | @implementation ContactHeadCell
12 | {
13 | Contacts *_contact;
14 | }
15 |
16 | - (instancetype)init:(Contacts *)contact
17 | {
18 | self = [super init];
19 |
20 | if (!self) {
21 | return nil;
22 | }
23 | self.selectionStyle = UITableViewCellSelectionStyleNone;
24 |
25 | _contact = contact;
26 |
27 | [self generateHeadCell];
28 |
29 | return self;
30 | }
31 |
32 | -(void)generateHeadCell{
33 |
34 | CGFloat padding = 20;
35 |
36 | UIImageView *headbgimageview = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 200)];
37 | headbgimageview.image = [UIImage imageNamed:@"note_bg.png"];
38 | headbgimageview.contentMode = UIViewContentModeScaleAspectFill;
39 | [self.contentView addSubview:headbgimageview];
40 |
41 | UIImageView *headimageview = [[UIImageView alloc] initWithFrame:CGRectMake(([UIScreen mainScreen].bounds.size.width-105)/2, 98, 108, 105)];
42 | headimageview.image = [UIImage imageNamed:@"touxiang2.png"];
43 | headimageview.contentMode = UIViewContentModeScaleAspectFill;
44 | headimageview.layer.masksToBounds = YES;
45 | headimageview.layer.cornerRadius = 50;
46 | [self.contentView addSubview:headimageview];
47 |
48 | UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(([UIScreen mainScreen].bounds.size.width-120)/2, CGRectGetMaxY(headimageview.frame)+ 15, 120, 20)];
49 | NSString *name = _contact.name;
50 | titleLabel.text = name;
51 | titleLabel.font = [UIFont systemFontOfSize:20];
52 | titleLabel.textAlignment = NSTextAlignmentCenter;
53 |
54 | [self.contentView addSubview:titleLabel];
55 |
56 | self.height = CGRectGetMaxY(titleLabel.frame) + padding/2;
57 |
58 |
59 | }
60 |
61 |
62 |
63 | @end
64 |
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/AddressBookViewController.xib:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactDetailViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactDetailViewController.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactDetailViewController.h"
10 | #import "ContactHeadCell.h"
11 | #import "ContactPersonInfoCell.h"
12 | #import "ContactSchoolInfoCell.h"
13 |
14 | @interface ContactDetailViewController ()
15 |
16 | @end
17 |
18 | @implementation ContactDetailViewController
19 |
20 | - (instancetype)init
21 | {
22 | self = [super initWithStyle:UITableViewStyleGrouped]; // grouped tableview
23 | if(!self){
24 | return nil;
25 | }
26 |
27 | return self;
28 | }
29 |
30 |
31 | - (void)viewDidLoad {
32 | [super viewDidLoad];
33 | // Do any additional setup after loading the view.
34 |
35 | self.title = @"详细资料";
36 |
37 |
38 | }
39 |
40 | - (void)viewWillAppear:(BOOL)animated {
41 | [super viewWillAppear:animated];
42 |
43 | ContactHeadCell *headCell = [[ContactHeadCell alloc] init: self.contact];
44 | ContactDetailSection *headSection = [ContactDetailSection sectionWithHeaderTitle:nil cells:@[headCell]];
45 |
46 |
47 | ContactPersonInfoCell *personinfoCell = [[ContactPersonInfoCell alloc] init: self.contact];
48 | // 编辑 按钮
49 | ContactDetailSection *personinfoSection = [ContactDetailSection sectionWithHeaderTitle:nil cells:@[personinfoCell]];
50 |
51 |
52 | ContactSchoolInfoCell *schoolinfoCell = [[ContactSchoolInfoCell alloc] init: self.contact];
53 | // 编辑 按钮
54 | ContactDetailSection *schoolinfoSection = [ContactDetailSection sectionWithHeaderTitle:nil cells:@[schoolinfoCell]];
55 |
56 |
57 |
58 |
59 | self.sections = @[headSection, personinfoSection, schoolinfoSection];
60 |
61 |
62 | }
63 |
64 | - (void)viewDidUnload
65 | {
66 | [super viewDidUnload];
67 | }
68 |
69 | - (void)didReceiveMemoryWarning {
70 | [super didReceiveMemoryWarning];
71 | // Dispose of any resources that can be recreated.
72 | }
73 |
74 |
75 |
76 |
77 |
78 | @end
79 |
--------------------------------------------------------------------------------
/Contacts/Classes/AddContact/AddContactsViewController.xib:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/Base/UIImage+TKUtilities.m:
--------------------------------------------------------------------------------
1 | //
2 | // UIImage+TKUtilities.m
3 | // TKContactsMultiPicker
4 | //
5 | // Created by Jongtae Ahn on 12. 8. 31..
6 | // Copyright (c) 2012년 TABKO Inc. All rights reserved.
7 | //
8 |
9 | #import "UIImage+TKUtilities.h"
10 | #import
11 |
12 | @implementation UIImage (TKUtilities)
13 |
14 | - (UIImage*)thumbnailImage:(CGSize)targetSize
15 | {
16 | UIImage *sourceImage = self;
17 | UIImage *newImage = nil;
18 | CGFloat screenScale = [[UIScreen mainScreen] scale];
19 | CGSize imageSize = sourceImage.size;
20 | CGFloat width = imageSize.width;
21 | CGFloat height = imageSize.height;
22 | CGFloat targetWidth = targetSize.width * screenScale;
23 | CGFloat targetHeight = targetSize.height * screenScale;
24 | CGFloat scaleFactor = 0.0;
25 | CGFloat scaledWidth = targetWidth;
26 | CGFloat scaledHeight = targetHeight;
27 | CGPoint thumbnailPoint = CGPointMake(0.0,0.0);
28 |
29 | if (CGSizeEqualToSize(imageSize, targetSize) == NO)
30 | {
31 | CGFloat widthFactor = targetWidth / width;
32 | CGFloat heightFactor = targetHeight / height;
33 |
34 | if (widthFactor > heightFactor)
35 | scaleFactor = widthFactor; // scale to fit height
36 | else
37 | scaleFactor = heightFactor; // scale to fit width
38 | scaledWidth = width * scaleFactor;
39 | scaledHeight = height * scaleFactor;
40 |
41 | // center the image
42 | if (widthFactor > heightFactor)
43 | {
44 | thumbnailPoint.y = (targetHeight - scaledHeight) * 0.5;
45 | }
46 | else
47 | if (widthFactor < heightFactor)
48 | {
49 | thumbnailPoint.x = (targetWidth - scaledWidth) * 0.5;
50 | }
51 | }
52 |
53 | UIGraphicsBeginImageContext(CGSizeMake(targetWidth, targetHeight)); // this will crop
54 |
55 | CGRect thumbnailRect = CGRectZero;
56 | thumbnailRect.origin = thumbnailPoint;
57 | thumbnailRect.size.width = scaledWidth;
58 | thumbnailRect.size.height = scaledHeight;
59 |
60 | [sourceImage drawInRect:thumbnailRect];
61 |
62 | newImage = UIGraphicsGetImageFromCurrentImageContext();
63 |
64 | UIGraphicsEndImageContext();
65 | return newImage;
66 | }
67 |
68 | @end
69 |
--------------------------------------------------------------------------------
/Contacts/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "ViewController.h"
11 |
12 | @interface AppDelegate ()
13 |
14 | @end
15 |
16 | @implementation AppDelegate
17 |
18 |
19 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
20 | // Override point for customization after application launch.
21 |
22 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
23 | // Override point for customization after application launch.
24 | self.window.backgroundColor = [UIColor whiteColor];
25 | self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:[[ViewController alloc] init]];
26 |
27 | [self.window makeKeyAndVisible];
28 | return YES;
29 | }
30 |
31 | - (void)applicationWillResignActive:(UIApplication *)application {
32 | // 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.
33 | // 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.
34 | }
35 |
36 | - (void)applicationDidEnterBackground:(UIApplication *)application {
37 | // 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.
38 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
39 | }
40 |
41 | - (void)applicationWillEnterForeground:(UIApplication *)application {
42 | // 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.
43 | }
44 |
45 | - (void)applicationDidBecomeActive:(UIApplication *)application {
46 | // 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.
47 | }
48 |
49 | - (void)applicationWillTerminate:(UIApplication *)application {
50 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
51 | }
52 |
53 | @end
54 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactDetailSection.h:
--------------------------------------------------------------------------------
1 | //
2 | // ContactDetailSection.h
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @class ContactCell;
13 |
14 |
15 | @interface ContactDetailSection : NSObject
16 |
17 | typedef UITableViewCell * (^CellForRowBlock)(UITableView *tableView, NSInteger row);
18 | typedef void (^CellActionBlock)(NSInteger row);
19 |
20 | @property (nonatomic, strong) NSMutableArray *cells;
21 |
22 | @property (nonatomic, strong) NSString *headerTitle;
23 | @property (nonatomic, strong) NSString *footerTitle;
24 |
25 | @property (nonatomic, strong) UIView *headerView;
26 | @property (nonatomic, strong) UIView *footerView;
27 |
28 | @property (nonatomic) CGFloat headerHeight;
29 | @property (nonatomic) CGFloat footerHeight;
30 |
31 | @property (nonatomic, readonly) BOOL reuseEnabled;
32 | @property (nonatomic) NSInteger reusedCellCount;
33 | @property (nonatomic, readonly) CGFloat reusedCellHeight;
34 | @property (nonatomic, copy, readonly) CellForRowBlock cellForRowBlock;
35 | @property (nonatomic, copy, readonly) CellActionBlock reusedCellActionBlock;
36 |
37 |
38 | #pragma mark - Convenience initializers without reuse
39 |
40 | + (instancetype)sectionWithCells:(NSArray *)cells;
41 | + (instancetype)sectionWithHeaderTitle:(NSString *)headerTitle cells:(NSArray *)cells;
42 | + (instancetype)sectionWithHeaderTitle:(NSString *)headerTitle footerTitle:(NSString *)footerTitle cells:(NSArray *)cells;
43 | + (instancetype)sectionWithHeaderTitle:(NSString *)headerTitle footerView:(UIView *)footerView footerHeight:(CGFloat)footerHeight cells:(NSArray *)cells;
44 | + (instancetype)sectionWithHeaderView:(UIView *)headerView headerHeight:(CGFloat)headerHeight cells:(NSArray *)cells;
45 | + (instancetype)sectionWithHeaderView:(UIView *)headerView headerHeight:(CGFloat)headerHeight footerTitle:(NSString *)footerTitle cells:(NSArray *)cells;
46 | + (instancetype)sectionWithHeaderView:(UIView *)headerView headerHeight:(CGFloat)headerHeight footerView:(UIView *)footerView footerHeight:(CGFloat)footerHeight cells:(NSArray *)cells;
47 | + (instancetype)sectionWithFooterTitle:(NSString *)footerTitle cells:(NSArray *)cells;
48 | + (instancetype)sectionWithFooterView:(UIView *)footerView footerHeight:(CGFloat)footerHeight cells:(NSArray *)cells;
49 |
50 |
51 | #pragma mark - Using cell reuse
52 |
53 | + (instancetype)sectionSupportingReuseWithTitle:(NSString *)title cellCount:(NSInteger)cellCount cellHeight:(CGFloat)cellHeight cellForRowBlock:(CellForRowBlock)cellForRowBlock actionBlock:(CellActionBlock)actionBlock;
54 |
55 |
56 | @end
57 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/ContactCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/ContactsTableView.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactsTableView.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactsTableView.h"
10 | #import "ContactsTableViewIndex.h"
11 |
12 | @interface ContactsTableView()
13 |
14 | @property (nonatomic, strong) ContactsTableViewIndex * tableViewIndex;
15 |
16 | @end
17 |
18 | @implementation ContactsTableView
19 |
20 |
21 | - (id)initWithFrame:(CGRect)frame
22 | {
23 | self = [super initWithFrame:frame];
24 | if (self) {
25 | // Initialization code
26 |
27 | self.tableView = [[UITableView alloc] initWithFrame:self.bounds style:UITableViewStylePlain];
28 | self.tableView.showsVerticalScrollIndicator = NO;
29 | [self addSubview:self.tableView];
30 |
31 | self.tableViewIndex = [[ContactsTableViewIndex alloc] initWithFrame:(CGRect){self.bounds.size.width - 20, 0, 20, frame.size.height-0}];
32 | [self addSubview:self.tableViewIndex];
33 |
34 | }
35 | return self;
36 | }
37 |
38 | - (void)setDelegate:(id)delegate
39 | {
40 | _delegate = delegate;
41 | self.tableView.delegate = delegate;
42 | self.tableView.dataSource = delegate;
43 | self.tableViewIndex.indexes = [self.delegate sectionIndexTitlesForABELTableView:self];
44 | CGRect rect = self.tableViewIndex.frame;
45 | rect.size.height = self.tableViewIndex.indexes.count * 16;
46 | rect.origin.y = (self.bounds.size.height - rect.size.height) / 2;
47 | self.tableViewIndex.frame = rect;
48 |
49 | self.tableViewIndex.tableViewIndexDelegate = self;
50 | }
51 |
52 | - (void)reloadData
53 | {
54 | [self.tableView reloadData];
55 |
56 | UIEdgeInsets edgeInsets = self.tableView.contentInset;
57 |
58 | self.tableViewIndex.indexes = [self.delegate sectionIndexTitlesForABELTableView:self];
59 | CGRect rect = self.tableViewIndex.frame;
60 | rect.size.height = self.tableViewIndex.indexes.count * 16;
61 | rect.origin.y = (self.bounds.size.height - rect.size.height - edgeInsets.top - edgeInsets.bottom) / 2 + edgeInsets.top + 20;
62 | self.tableViewIndex.frame = rect;
63 | self.tableViewIndex.tableViewIndexDelegate = self;
64 | }
65 |
66 |
67 | //#pragma mark -
68 | - (void)tableViewIndex:(ContactsTableViewIndex *)tableViewIndex didSelectSectionAtIndex:(NSInteger)index withTitle:(NSString *)title
69 | {
70 | if ([self.tableView numberOfSections] > index && index > -1){
71 |
72 | [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:index]
73 | atScrollPosition:UITableViewScrollPositionTop
74 | animated:NO];
75 | }
76 |
77 | }
78 |
79 | - (void)tableViewIndexTouchesBegan:(ContactsTableViewIndex *)tableViewIndex
80 | {
81 | }
82 |
83 | - (void)tableViewIndexTouchesEnd:(ContactsTableViewIndex *)tableViewIndex
84 | {
85 | CATransition *animation = [CATransition animation];
86 | animation.type = kCATransitionFade;
87 | animation.duration = 0.4;
88 |
89 |
90 | }
91 |
92 | - (NSArray *)tableViewIndexTitle:(ContactsTableViewIndex *)tableViewIndex
93 | {
94 | return [self.delegate sectionIndexTitlesForABELTableView:self];
95 | }
96 |
97 |
98 | @end
99 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactSchoolInfoCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactSchoolInfoCell.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactSchoolInfoCell.h"
10 |
11 | @implementation ContactSchoolInfoCell
12 | {
13 | Contacts *_contact;
14 | }
15 |
16 | - (instancetype)init:(Contacts *)contact
17 | {
18 | self = [super init];
19 |
20 | if (!self) {
21 | return nil;
22 | }
23 | self.selectionStyle = UITableViewCellSelectionStyleNone;
24 |
25 | _contact = contact;
26 |
27 | [self generateSchoolInfoCell];
28 |
29 | return self;
30 | }
31 |
32 | -(void)generateSchoolInfoCell{
33 |
34 | CGFloat padding = 20;
35 |
36 | UILabel *schooltitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(padding, padding/2, 100, 20)];
37 | schooltitleLabel.text = @"学 校:";
38 | schooltitleLabel.font = [UIFont systemFontOfSize:15];
39 | [self.contentView addSubview:schooltitleLabel];
40 |
41 | UILabel *schoolLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, padding/2, 150, 20)];
42 | NSString *school = nil;
43 | schoolLabel.text = school;
44 | schoolLabel.font = [UIFont systemFontOfSize:18];
45 | [self.contentView addSubview:schoolLabel];
46 |
47 | UILabel *departtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(padding, CGRectGetMaxY(schoolLabel.frame) + 6, 100, 20)];
48 | departtitleLabel.text = @"院 系:";
49 | departtitleLabel.font = [UIFont systemFontOfSize:15];
50 | [self.contentView addSubview:departtitleLabel];
51 |
52 | UILabel *departLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, CGRectGetMaxY(schoolLabel.frame) + 6, 150, 20)];
53 | NSString *depart = nil;
54 | departLabel.text = depart;
55 | departLabel.font = [UIFont systemFontOfSize:15];
56 | [self.contentView addSubview:departLabel];
57 |
58 |
59 | UILabel *timegotoschooltitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(padding, CGRectGetMaxY(departLabel.frame) + 6, 100, 20)];
60 | timegotoschooltitleLabel.text = @"入学年份:";
61 | timegotoschooltitleLabel.font = [UIFont systemFontOfSize:15];
62 | [self.contentView addSubview:timegotoschooltitleLabel];
63 |
64 | UILabel *timegotoschoolLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, CGRectGetMaxY(departLabel.frame) + 6, 150, 20)];
65 | NSString *timegotoschool = nil;
66 | timegotoschoolLabel.text = timegotoschool;
67 | timegotoschoolLabel.font = [UIFont systemFontOfSize:15];
68 | [self.contentView addSubview:timegotoschoolLabel];
69 |
70 | UILabel *dormtitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(padding, CGRectGetMaxY(timegotoschoolLabel.frame) + 6, 100, 20)];
71 | dormtitleLabel.text = @"宿 舍:";
72 | dormtitleLabel.font = [UIFont systemFontOfSize:15];
73 | [self.contentView addSubview:dormtitleLabel];
74 |
75 | UILabel *dormLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, CGRectGetMaxY(timegotoschoolLabel.frame) + 6, 150, 20)];
76 | NSString *dorm = nil;
77 | dormLabel.text = dorm;
78 | dormLabel.font = [UIFont systemFontOfSize:15];
79 | [self.contentView addSubview:dormLabel];
80 |
81 |
82 | self.height = CGRectGetMaxY(dormLabel.frame) + padding/2;
83 |
84 |
85 | }
86 |
87 |
88 | @end
89 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactPersonInfoCell.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactPersonInfoCell.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactPersonInfoCell.h"
10 |
11 | @implementation ContactPersonInfoCell
12 | {
13 | Contacts *_contact;
14 | }
15 |
16 | - (instancetype)init:(Contacts *)contact
17 | {
18 | self = [super init];
19 |
20 | if (!self) {
21 | return nil;
22 | }
23 | self.selectionStyle = UITableViewCellSelectionStyleNone;
24 |
25 | _contact = contact;
26 |
27 | [self generatePersonInfoCell];
28 |
29 | return self;
30 | }
31 |
32 | -(void)generatePersonInfoCell{
33 |
34 | CGFloat padding = 20;
35 |
36 | UILabel *nametitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(padding, padding/2, 100, 20)];
37 | nametitleLabel.text = @"昵 称:";
38 | nametitleLabel.font = [UIFont systemFontOfSize:15];
39 | [self.contentView addSubview:nametitleLabel];
40 |
41 | UILabel *nicknameLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, padding/2, 200, 20)];
42 | NSString *nickname = _contact.name;
43 | nicknameLabel.text = nickname;
44 | nicknameLabel.font = [UIFont systemFontOfSize:15];
45 | [self.contentView addSubview:nicknameLabel];
46 |
47 | UILabel *truenametitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(padding, CGRectGetMaxY(nicknameLabel.frame) + 6, 100, 20)];
48 | truenametitleLabel.text = @"真实姓名:";
49 | truenametitleLabel.font = [UIFont systemFontOfSize:15];
50 | [self.contentView addSubview:truenametitleLabel];
51 |
52 | UILabel *truenameLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, CGRectGetMaxY(nicknameLabel.frame) + 6, 200, 20)];
53 | NSString *truename = nil;
54 | truenameLabel.text = truename;
55 | truenameLabel.font = [UIFont systemFontOfSize:15];
56 | [self.contentView addSubview:truenameLabel];
57 |
58 |
59 | UILabel *birthdaytitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(padding, CGRectGetMaxY(truenameLabel.frame) + 6, 100, 20)];
60 | birthdaytitleLabel.text = @"出生日期:";
61 | birthdaytitleLabel.font = [UIFont systemFontOfSize:15];
62 | [self.contentView addSubview:birthdaytitleLabel];
63 |
64 | UILabel *birthdayLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, CGRectGetMaxY(truenameLabel.frame) + 6, 200, 20)];
65 | NSString *birthday = nil;
66 | birthdayLabel.text = birthday;
67 | birthdayLabel.font = [UIFont systemFontOfSize:15];
68 | [self.contentView addSubview:birthdayLabel];
69 |
70 | UILabel *signaturetitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(padding, CGRectGetMaxY(birthdayLabel.frame) + 6, 100, 20)];
71 | signaturetitleLabel.text = @"个性签名:";
72 | signaturetitleLabel.font = [UIFont systemFontOfSize:15];
73 | [self.contentView addSubview:signaturetitleLabel];
74 |
75 | UILabel *signatureLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, CGRectGetMaxY(birthdayLabel.frame) + 6, 200, 20)];
76 | NSString *signature = @"啥都没有呢!!!!";
77 | signatureLabel.text = signature;
78 | signatureLabel.font = [UIFont systemFontOfSize:15];
79 | [self.contentView addSubview:signatureLabel];
80 |
81 |
82 | self.height = CGRectGetMaxY(signatureLabel.frame) + padding/2;
83 |
84 |
85 | }
86 |
87 |
88 | @end
89 |
--------------------------------------------------------------------------------
/Contacts/Classes/AddContact/RecomendsCell.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/Contacts/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
20 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactDetailTableViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactDetailTableViewController.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactDetailTableViewController.h"
10 |
11 | @interface ContactDetailTableViewController ()
12 |
13 | @end
14 |
15 | @implementation ContactDetailTableViewController
16 |
17 | - (void)viewDidLoad {
18 | [super viewDidLoad];
19 | }
20 |
21 | - (void)didReceiveMemoryWarning {
22 | [super didReceiveMemoryWarning];
23 | // Dispose of any resources that can be recreated.
24 | }
25 |
26 | #pragma mark - Setting sections
27 |
28 | - (void)setSections:(NSArray *)sections {
29 | _sections = sections;
30 |
31 | [self.tableView reloadData];
32 | }
33 |
34 | #pragma mark - Table view data source
35 |
36 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
37 | return self.sections.count;
38 | }
39 |
40 | - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
41 | ContactDetailSection *contactSection = self.sections[section];
42 | return contactSection.headerView;
43 | }
44 |
45 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
46 | ContactDetailSection *contactSection = self.sections[section];
47 | return contactSection.headerTitle;
48 | }
49 |
50 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
51 | ContactDetailSection *contactSection = self.sections[section];
52 | return contactSection.headerHeight;
53 | }
54 |
55 | - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
56 | ContactDetailSection *contactSection = self.sections[section];
57 | return contactSection.footerView;
58 | }
59 |
60 | - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section {
61 | ContactDetailSection *contactSection = self.sections[section];
62 | return contactSection.footerTitle;
63 | }
64 |
65 | - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
66 | ContactDetailSection *contactSection = self.sections[section];
67 | return contactSection.footerHeight;
68 | }
69 |
70 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
71 | ContactDetailSection *contactSection = self.sections[section];
72 | return contactSection.reuseEnabled ? contactSection.reusedCellCount : contactSection.cells.count;
73 | }
74 |
75 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
76 | ContactDetailSection *contactSection = self.sections[indexPath.section];
77 |
78 | if (contactSection.reuseEnabled) {
79 | return contactSection.reusedCellHeight;
80 | }
81 |
82 | else {
83 | ContactDetailCell *cell = contactSection.cells[indexPath.row];
84 | return cell.height;
85 | }
86 | }
87 |
88 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
89 | ContactDetailSection *contactSection = self.sections[indexPath.section];
90 |
91 | if (contactSection.reuseEnabled) {
92 | return contactSection.cellForRowBlock(tableView, indexPath.row);
93 | }
94 |
95 | else {
96 | return contactSection.cells[indexPath.row];
97 | }
98 | }
99 |
100 |
101 | #pragma mark - Table view delegate
102 |
103 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
104 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
105 |
106 | ContactDetailSection *contactSection = self.sections[indexPath.section];
107 |
108 | if (contactSection.reuseEnabled) {
109 | if (contactSection.reusedCellActionBlock) {
110 | contactSection.reusedCellActionBlock(indexPath.row);
111 | }
112 | }
113 |
114 | else {
115 | ContactDetailCell *cell = contactSection.cells[indexPath.row];
116 |
117 | if (cell.actionBlock) {
118 | cell.actionBlock();
119 | }
120 | }
121 | }
122 |
123 | @end
124 |
--------------------------------------------------------------------------------
/Contacts.xcodeproj/xcuserdata/emma.xcuserdatad/xcschemes/Contacts.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
29 |
35 |
36 |
37 |
38 |
39 |
44 |
45 |
47 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
65 |
66 |
75 |
77 |
83 |
84 |
85 |
86 |
87 |
88 |
94 |
96 |
102 |
103 |
104 |
105 |
107 |
108 |
111 |
112 |
113 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/ContactsTableViewIndex.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactsTableViewIndex.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactsTableViewIndex.h"
10 |
11 | #if !__has_feature(objc_arc)
12 | #error AIMTableViewIndexBar must be built with ARC.
13 | // You can turn on ARC for only AIMTableViewIndexBar files by adding -fobjc-arc to the build phase for each of its files.
14 | #endif
15 |
16 | #define RGB(r,g,b,a) [UIColor colorWithRed:(double)r/255.0f green:(double)g/255.0f blue:(double)b/255.0f alpha:a]
17 |
18 | @interface ContactsTableViewIndex (){
19 | BOOL isLayedOut;
20 | CAShapeLayer *shapeLayer;
21 | CGFloat letterHeight;
22 | }
23 |
24 | @property (nonatomic, strong) NSArray *letters;
25 |
26 | @end
27 |
28 | @implementation ContactsTableViewIndex
29 |
30 | - (id)initWithFrame:(CGRect)frame{
31 | if (self = [super initWithFrame:frame]) {
32 | self.backgroundColor = [UIColor clearColor];
33 | }
34 | return self;
35 | }
36 |
37 | - (void)setup{
38 | shapeLayer = [CAShapeLayer layer];
39 | shapeLayer.lineWidth = 1.0f;
40 | shapeLayer.fillColor = [UIColor clearColor].CGColor;
41 | shapeLayer.lineJoin = kCALineCapSquare;
42 | shapeLayer.strokeColor = [[UIColor clearColor] CGColor];
43 | shapeLayer.strokeEnd = 1.0f;
44 | self.layer.masksToBounds = NO;
45 | }
46 |
47 | - (void)setTableViewIndexDelegate:(id)tableViewIndexDelegate
48 | {
49 | _tableViewIndexDelegate = tableViewIndexDelegate;
50 | self.letters = [self.tableViewIndexDelegate tableViewIndexTitle:self];
51 | isLayedOut = NO;
52 | [self layoutSubviews];
53 | }
54 |
55 | - (void)layoutSubviews{
56 | [super layoutSubviews];
57 | [self setup];
58 |
59 | if (!isLayedOut){
60 |
61 | [self.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)];
62 |
63 | shapeLayer.frame = (CGRect) {.origin = CGPointZero, .size = self.layer.frame.size};
64 | UIBezierPath *bezierPath = [UIBezierPath bezierPath];
65 | [bezierPath moveToPoint:CGPointZero];
66 | [bezierPath addLineToPoint:CGPointMake(0, self.frame.size.height)];
67 | letterHeight = 16; //self.frame.size.height / [letters count];
68 | CGFloat fontSize = 12;
69 | if (letterHeight < 14){
70 | fontSize = 11;
71 | }
72 |
73 | [self.letters enumerateObjectsUsingBlock:^(NSString *letter, NSUInteger idx, BOOL *stop) {
74 | CGFloat originY = idx * letterHeight;
75 | CATextLayer *ctl = [self textLayerWithSize:fontSize
76 | string:letter
77 | andFrame:CGRectMake(0, originY, self.frame.size.width, letterHeight)];
78 | [self.layer addSublayer:ctl];
79 | [bezierPath moveToPoint:CGPointMake(0, originY)];
80 | [bezierPath addLineToPoint:CGPointMake(ctl.frame.size.width, originY)];
81 | }];
82 |
83 | shapeLayer.path = bezierPath.CGPath;
84 | [self.layer addSublayer:shapeLayer];
85 |
86 | isLayedOut = YES;
87 | }
88 | }
89 |
90 | - (CATextLayer*)textLayerWithSize:(CGFloat)size string:(NSString*)string andFrame:(CGRect)frame{
91 | CATextLayer *tl = [CATextLayer layer];
92 | [tl setFont:@"ArialMT"];
93 | [tl setFontSize:size];
94 | [tl setFrame:frame];
95 | [tl setAlignmentMode:kCAAlignmentCenter];
96 | [tl setContentsScale:[[UIScreen mainScreen] scale]];
97 | [tl setForegroundColor:RGB(168, 168, 168, 1).CGColor];
98 | [tl setString:string];
99 | return tl;
100 | }
101 |
102 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
103 | [super touchesBegan:touches withEvent:event];
104 | [self sendEventToDelegate:event];
105 | [self.tableViewIndexDelegate tableViewIndexTouchesBegan:self];
106 | }
107 |
108 | - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
109 | [super touchesMoved:touches withEvent:event];
110 | [self sendEventToDelegate:event];
111 | }
112 |
113 | - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
114 | {
115 | [self.tableViewIndexDelegate tableViewIndexTouchesEnd:self];
116 | }
117 |
118 | - (void)sendEventToDelegate:(UIEvent*)event{
119 | UITouch *touch = [[event allTouches] anyObject];
120 | CGPoint point = [touch locationInView:self];
121 |
122 | NSInteger indx = ((NSInteger) floorf(point.y) / letterHeight);
123 |
124 | if (indx< 0 || indx > self.letters.count - 1) {
125 | return;
126 | }
127 |
128 | [self.tableViewIndexDelegate tableViewIndex:self didSelectSectionAtIndex:indx withTitle:self.letters[indx]];
129 | }
130 |
131 |
132 | @end
133 |
--------------------------------------------------------------------------------
/Contacts.xcodeproj/xcuserdata/emma.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
8 |
20 |
21 |
22 |
24 |
36 |
37 |
38 |
40 |
52 |
53 |
54 |
56 |
62 |
63 |
64 |
66 |
78 |
79 |
80 |
82 |
94 |
95 |
96 |
98 |
110 |
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactDetail/ContactDetailSection.m:
--------------------------------------------------------------------------------
1 | //
2 | // ContactDetailSection.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/26.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "ContactDetailSection.h"
10 |
11 | @implementation ContactDetailSection
12 |
13 | #pragma mark - Cells
14 |
15 | + (instancetype)sectionWithCells:(NSArray *)cells {
16 | return [[self class] sectionWithHeaderTitle:nil headerView:nil headerHeight:UITableViewAutomaticDimension footerTitle:nil footerView:nil footerHeight:UITableViewAutomaticDimension cells:cells];
17 | }
18 |
19 |
20 | #pragma mark - Header title
21 |
22 | + (instancetype)sectionWithHeaderTitle:(NSString *)headerTitle cells:(NSArray *)cells {
23 | return [[self class] sectionWithHeaderTitle:headerTitle headerView:nil headerHeight:UITableViewAutomaticDimension footerTitle:nil footerView:nil footerHeight:UITableViewAutomaticDimension cells:cells];
24 | }
25 |
26 | + (instancetype)sectionWithHeaderTitle:(NSString *)headerTitle footerTitle:(NSString *)footerTitle cells:(NSArray *)cells {
27 | return [[self class] sectionWithHeaderTitle:headerTitle headerView:nil headerHeight:UITableViewAutomaticDimension footerTitle:footerTitle footerView:nil footerHeight:UITableViewAutomaticDimension cells:cells];
28 | }
29 |
30 | + (instancetype)sectionWithHeaderTitle:(NSString *)headerTitle footerView:(UIView *)footerView footerHeight:(CGFloat)footerHeight cells:(NSArray *)cells {
31 | return [[self class] sectionWithHeaderTitle:headerTitle headerView:nil headerHeight:UITableViewAutomaticDimension footerTitle:nil footerView:footerView footerHeight:footerHeight cells:cells];
32 | }
33 |
34 |
35 | #pragma mark - Header view
36 |
37 | + (instancetype)sectionWithHeaderView:(UIView *)headerView headerHeight:(CGFloat)headerHeight cells:(NSArray *)cells {
38 | return [[self class] sectionWithHeaderTitle:nil headerView:headerView headerHeight:headerHeight footerTitle:nil footerView:nil footerHeight:UITableViewAutomaticDimension cells:cells];
39 | }
40 |
41 | + (instancetype)sectionWithHeaderView:(UIView *)headerView headerHeight:(CGFloat)headerHeight footerTitle:(NSString *)footerTitle cells:(NSArray *)cells {
42 | return [[self class] sectionWithHeaderTitle:nil headerView:headerView headerHeight:headerHeight footerTitle:footerTitle footerView:nil footerHeight:UITableViewAutomaticDimension cells:cells];
43 | }
44 |
45 | + (instancetype)sectionWithHeaderView:(UIView *)headerView headerHeight:(CGFloat)headerHeight footerView:(UIView *)footerView footerHeight:(CGFloat)footerHeight cells:(NSArray *)cells {
46 | return [[self class] sectionWithHeaderTitle:nil headerView:headerView headerHeight:headerHeight footerTitle:nil footerView:footerView footerHeight:footerHeight cells:cells];
47 | }
48 |
49 |
50 | #pragma mark - Footer title
51 |
52 | + (instancetype)sectionWithFooterTitle:(NSString *)footerTitle cells:(NSArray *)cells {
53 | return [[self class] sectionWithHeaderTitle:nil headerView:nil headerHeight:UITableViewAutomaticDimension footerTitle:footerTitle footerView:nil footerHeight:UITableViewAutomaticDimension cells:cells];
54 | }
55 |
56 |
57 | #pragma mark - Footer view
58 |
59 | + (instancetype)sectionWithFooterView:(UIView *)footerView footerHeight:(CGFloat)footerHeight cells:(NSArray *)cells {
60 | return [[self class] sectionWithHeaderTitle:nil headerView:nil headerHeight:UITableViewAutomaticDimension footerTitle:nil footerView:footerView footerHeight:footerHeight cells:cells];
61 | }
62 |
63 |
64 | #pragma mark - The whole shabang
65 |
66 | + (instancetype)sectionWithHeaderTitle:(NSString *)headerTitle headerView:(UIView *)headerView headerHeight:(CGFloat)headerHeight footerTitle:(NSString *)footerTitle footerView:(UIView *)footerView footerHeight:(CGFloat)footerHeight cells:(NSArray *)cells {
67 | ContactDetailSection *section = [[self class] new];
68 | section.headerTitle = headerTitle;
69 | section.headerView = headerView;
70 | section.headerHeight = headerHeight;
71 | section.footerTitle = footerTitle;
72 | section.footerView = footerView;
73 | section.footerHeight = footerHeight;
74 | section.cells = [cells mutableCopy];
75 | return section;
76 | }
77 |
78 |
79 | #pragma mark - Reuse
80 |
81 | + (instancetype)sectionSupportingReuseWithTitle:(NSString *)title cellCount:(NSInteger)cellCount cellHeight:(CGFloat)cellHeight cellForRowBlock:(CellForRowBlock)cellForRowBlock actionBlock:(CellActionBlock)actionBlock {
82 | return [[[self class] alloc] initSectionSupportingReuseWithTitle:title cellCount:cellCount cellHeight:cellHeight cellForRowBlock:cellForRowBlock actionBlock:actionBlock];
83 | }
84 |
85 | - (instancetype)initSectionSupportingReuseWithTitle:(NSString *)title cellCount:(NSInteger)cellCount cellHeight:(CGFloat)cellHeight cellForRowBlock:(CellForRowBlock)cellForRowBlock actionBlock:(CellActionBlock)actionBlock {
86 | self = [[self class] sectionWithHeaderTitle:title cells:nil];
87 |
88 | _reuseEnabled = YES;
89 | _reusedCellCount = cellCount;
90 | _reusedCellHeight = cellHeight;
91 | _cellForRowBlock = cellForRowBlock;
92 | _reusedCellActionBlock = actionBlock;
93 |
94 | return self;
95 | }
96 |
97 | @end
98 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/ChineseToPinyinResource.m:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | // Created by kimziv on 13-9-14.
5 | // 中文转拼音
6 |
7 | #include "ChineseToPinyinResource.h"
8 | #define LEFT_BRACKET @"("
9 | #define RIGHT_BRACKET @")"
10 | #define COMMA @","
11 |
12 | #define kCacheKeyForUnicode2Pinyin @"cache.key.for.unicode.to.pinyin"
13 |
14 | static inline NSString* cachePathForKey(NSString* directory, NSString* key) {
15 | return [directory stringByAppendingPathComponent:key];
16 | }
17 |
18 | @interface ChineseToPinyinResource ()
19 | - (id)cachedObjectForKey:(NSString*)key;
20 | -(void)cacheObjec:(id)obj forKey:(NSString *)key;
21 |
22 | @end
23 |
24 | @implementation ChineseToPinyinResource
25 | //@synthesize unicodeToHanyuPinyinTable=_unicodeToHanyuPinyinTable;
26 | //- (NSDictionary *)getUnicodeToHanyuPinyinTable {
27 | // return _unicodeToHanyuPinyinTable;
28 | //}
29 |
30 | - (id)init {
31 | if (self = [super init]) {
32 | _unicodeToHanyuPinyinTable = nil;
33 | [self initializeResource];
34 | }
35 | return self;
36 | }
37 |
38 | - (void)initializeResource {
39 | NSString* cachesDirectory = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0];
40 | NSString* oldCachesDirectory = [[[cachesDirectory stringByAppendingPathComponent:[[NSProcessInfo processInfo] processName]] stringByAppendingPathComponent:@"PinYinCache"] copy];
41 |
42 | if([[NSFileManager defaultManager] fileExistsAtPath:oldCachesDirectory]) {
43 | [[NSFileManager defaultManager] removeItemAtPath:oldCachesDirectory error:NULL];
44 | }
45 |
46 | _directory = [[[cachesDirectory stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]] stringByAppendingPathComponent:@"PinYinCache"] copy];
47 |
48 | NSDictionary *dataMap=(NSDictionary *)[self cachedObjectForKey:kCacheKeyForUnicode2Pinyin];
49 | if (dataMap) {
50 | self->_unicodeToHanyuPinyinTable=dataMap;
51 | }else{
52 | NSString *resourceName =[[NSBundle mainBundle] pathForResource:@"unicode_to_hanyu_pinyin" ofType:@"txt"];
53 | NSString *dictionaryText=[NSString stringWithContentsOfFile:resourceName encoding:NSUTF8StringEncoding error:nil];
54 | NSArray *lines = [dictionaryText componentsSeparatedByString:@"\r\n"];
55 | __block NSMutableDictionary *tempMap=[[NSMutableDictionary alloc] init];
56 | @autoreleasepool {
57 | [lines enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
58 | NSArray *lineComponents=[obj componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
59 | //NSLog(@"%@, %@",lineComponents[0],lineComponents[1]);
60 | [tempMap setObject:lineComponents[1] forKey:lineComponents[0]];
61 | }];
62 | }
63 | self->_unicodeToHanyuPinyinTable=tempMap;
64 | [self cacheObjec:self->_unicodeToHanyuPinyinTable forKey:kCacheKeyForUnicode2Pinyin];
65 | }
66 | }
67 |
68 | - (id)cachedObjectForKey:(NSString*)key
69 | {
70 | NSData *data = [NSData dataWithContentsOfFile:cachePathForKey(_directory, key) options:0 error:NULL];
71 | if (data) {
72 | return [NSKeyedUnarchiver unarchiveObjectWithData:data];
73 | }
74 | return nil;
75 | }
76 |
77 | -(void)cacheObjec:(id)obj forKey:(NSString *)key
78 | {
79 | NSData* data= [NSKeyedArchiver archivedDataWithRootObject:obj];
80 | NSString* cachePath = cachePathForKey(_directory, key);
81 | dispatch_async(dispatch_get_main_queue(), ^{
82 | [data writeToFile:cachePath atomically:YES];
83 | });
84 | }
85 |
86 | - (NSArray *)getHanyuPinyinStringArrayWithChar:(unichar)ch {
87 | NSString *pinyinRecord = [self getHanyuPinyinRecordFromCharWithChar:ch];
88 | if (nil != pinyinRecord) {
89 | NSRange rangeOfLeftBracket= [pinyinRecord rangeOfString:LEFT_BRACKET];
90 | NSRange rangeOfRightBracket= [pinyinRecord rangeOfString:RIGHT_BRACKET];
91 | NSString *stripedString = [pinyinRecord substringWithRange:NSMakeRange(rangeOfLeftBracket.location+rangeOfLeftBracket.length, rangeOfRightBracket.location-rangeOfLeftBracket.location-rangeOfLeftBracket.length)];
92 | return [stripedString componentsSeparatedByString:COMMA];
93 | }
94 | else return nil;
95 | }
96 |
97 | - (BOOL)isValidRecordWithNSString:(NSString *)record {
98 | NSString *noneStr = @"(none0)";
99 | if ((nil != record) && ![record isEqual:noneStr] && [record hasPrefix:LEFT_BRACKET] && [record hasSuffix:RIGHT_BRACKET]) {
100 | return YES;
101 | }
102 | else return NO;
103 | }
104 |
105 | - (NSString *)getHanyuPinyinRecordFromCharWithChar:(unichar)ch {
106 | int codePointOfChar = ch;
107 | NSString *codepointHexStr =[[NSString stringWithFormat:@"%x", codePointOfChar] uppercaseString];
108 | NSString *foundRecord =[self->_unicodeToHanyuPinyinTable objectForKey:codepointHexStr];
109 | return [self isValidRecordWithNSString:foundRecord] ? foundRecord : nil;
110 | }
111 |
112 | + (ChineseToPinyinResource *)getInstance {
113 | static ChineseToPinyinResource *sharedInstance=nil;
114 | static dispatch_once_t onceToken;
115 | dispatch_once(&onceToken, ^{
116 | sharedInstance=[[self alloc] init];
117 | });
118 | return sharedInstance;
119 | }
120 |
121 | @end
122 |
123 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/PinyinHelper.m:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | // Created by kimziv on 13-9-14.
5 | //
6 |
7 | #include "ChineseToPinyinResource.h"
8 | #include "HanyuPinyinOutputFormat.h"
9 | #include "PinyinFormatter.h"
10 | #include "PinyinHelper.h"
11 |
12 | #define HANYU_PINYIN @"Hanyu"
13 | #define WADEGILES_PINYIN @"Wade"
14 | #define MPS2_PINYIN @"MPSII"
15 | #define YALE_PINYIN @"Yale"
16 | #define TONGYONG_PINYIN @"Tongyong"
17 | #define GWOYEU_ROMATZYH @"Gwoyeu"
18 |
19 | @implementation PinyinHelper
20 |
21 | + (NSArray *)toHanyuPinyinStringArrayWithChar:(unichar)ch {
22 | return [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch];
23 | }
24 |
25 | + (NSArray *)toHanyuPinyinStringArrayWithChar:(unichar)ch
26 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat {
27 | return [PinyinHelper getFormattedHanyuPinyinStringArrayWithChar:ch withHanyuPinyinOutputFormat:outputFormat];
28 | }
29 |
30 | + (NSArray *)getFormattedHanyuPinyinStringArrayWithChar:(unichar)ch
31 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat {
32 | NSMutableArray *pinyinStrArray =[NSMutableArray arrayWithArray:[PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch]];
33 | if (nil != pinyinStrArray) {
34 | for (int i = 0; i < (int) [pinyinStrArray count]; i++) {
35 | [pinyinStrArray replaceObjectAtIndex:i withObject:[PinyinFormatter formatHanyuPinyinWithNSString:
36 | [pinyinStrArray objectAtIndex:i]withHanyuPinyinOutputFormat:outputFormat]];
37 | }
38 | return pinyinStrArray;
39 | }
40 | else return nil;
41 | }
42 |
43 | + (NSArray *)getUnformattedHanyuPinyinStringArrayWithChar:(unichar)ch {
44 | return [[ChineseToPinyinResource getInstance] getHanyuPinyinStringArrayWithChar:ch];
45 | }
46 |
47 | + (NSArray *)toTongyongPinyinStringArrayWithChar:(unichar)ch {
48 | return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: TONGYONG_PINYIN];
49 | }
50 |
51 | + (NSArray *)toWadeGilesPinyinStringArrayWithChar:(unichar)ch {
52 | return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: WADEGILES_PINYIN];
53 | }
54 |
55 | + (NSArray *)toMPS2PinyinStringArrayWithChar:(unichar)ch {
56 | return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: MPS2_PINYIN];
57 | }
58 |
59 | + (NSArray *)toYalePinyinStringArrayWithChar:(unichar)ch {
60 | return [PinyinHelper convertToTargetPinyinStringArrayWithChar:ch withPinyinRomanizationType: YALE_PINYIN];
61 | }
62 |
63 | + (NSArray *)convertToTargetPinyinStringArrayWithChar:(unichar)ch
64 | withPinyinRomanizationType:(NSString *)targetPinyinSystem {
65 | NSArray *hanyuPinyinStringArray = [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch];
66 | if (nil != hanyuPinyinStringArray) {
67 | NSMutableArray *targetPinyinStringArray = [NSMutableArray arrayWithCapacity:hanyuPinyinStringArray.count];
68 | for (int i = 0; i < (int) [hanyuPinyinStringArray count]; i++) {
69 |
70 | }
71 | return targetPinyinStringArray;
72 | }
73 | else return nil;
74 | }
75 |
76 | + (NSArray *)toGwoyeuRomatzyhStringArrayWithChar:(unichar)ch {
77 | return [PinyinHelper convertToGwoyeuRomatzyhStringArrayWithChar:ch];
78 | }
79 |
80 | + (NSArray *)convertToGwoyeuRomatzyhStringArrayWithChar:(unichar)ch {
81 | NSArray *hanyuPinyinStringArray = [PinyinHelper getUnformattedHanyuPinyinStringArrayWithChar:ch];
82 | if (nil != hanyuPinyinStringArray) {
83 | NSMutableArray *targetPinyinStringArray =[NSMutableArray arrayWithCapacity:hanyuPinyinStringArray.count];
84 | for (int i = 0; i < (int) [hanyuPinyinStringArray count]; i++) {
85 | }
86 | return targetPinyinStringArray;
87 | }
88 | else return nil;
89 | }
90 |
91 | + (NSString *)toHanyuPinyinStringWithNSString:(NSString *)str
92 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat
93 | withNSString:(NSString *)seperater {
94 | NSMutableString *resultPinyinStrBuf = [[NSMutableString alloc] init];
95 | for (int i = 0; i < str.length; i++) {
96 | NSString *mainPinyinStrOfChar = [PinyinHelper getFirstHanyuPinyinStringWithChar:[str characterAtIndex:i] withHanyuPinyinOutputFormat:outputFormat];
97 | if (nil != mainPinyinStrOfChar) {
98 | [resultPinyinStrBuf appendString:mainPinyinStrOfChar];
99 | if (i != [str length] - 1) {
100 | [resultPinyinStrBuf appendString:seperater];
101 | }
102 | }
103 | else {
104 | [resultPinyinStrBuf appendFormat:@"%C",[str characterAtIndex:i]];
105 | }
106 | }
107 | return resultPinyinStrBuf;
108 | }
109 |
110 | + (NSString *)getFirstHanyuPinyinStringWithChar:(unichar)ch
111 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat {
112 | NSArray *pinyinStrArray = [PinyinHelper getFormattedHanyuPinyinStringArrayWithChar:ch withHanyuPinyinOutputFormat:outputFormat];
113 | if ((nil != pinyinStrArray) && ((int) [pinyinStrArray count] > 0)) {
114 | return [pinyinStrArray objectAtIndex:0];
115 | }
116 | else {
117 | return nil;
118 | }
119 | }
120 |
121 | - (id)init {
122 | return [super init];
123 | }
124 |
125 | @end
126 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/NSString+PinYin4Cocoa.m:
--------------------------------------------------------------------------------
1 | //
2 | // NSString+PinYin4Cocoa.m
3 | // PinYin4Cocoa
4 | //
5 | // Created by kimziv on 13-9-15.
6 | // Copyright (c) 2013年 kimziv. All rights reserved.
7 | //
8 |
9 | #import "NSString+PinYin4Cocoa.h"
10 |
11 | @implementation NSString (PinYin4Cocoa)
12 |
13 |
14 | - (NSInteger)indexOfString:(NSString *)s {
15 | NSAssert3((s!=nil), @"Error, s is a nil string, %s, %s, %d", __FILE__, __FUNCTION__, __LINE__);
16 | if ([s length] == 0) {
17 | return 0;
18 | }
19 | NSRange range = [self rangeOfString:s];
20 | return range.location == NSNotFound ? -1 : (int) range.location;
21 | }
22 |
23 |
24 | - (NSInteger)indexOfString:(NSString *)s fromIndex:(int)index {
25 | NSAssert3((s!=nil), @"Error, s is a nil string, %s, %s, %d", __FILE__, __FUNCTION__, __LINE__);
26 | if ([s length] == 0) {
27 | return 0;
28 | }
29 | NSRange searchRange = NSMakeRange((NSUInteger) index,
30 | [self length] - (NSUInteger) index);
31 | NSRange range = [self rangeOfString:s
32 | options:NSLiteralSearch
33 | range:searchRange];
34 | return range.location == NSNotFound ? -1 : (int) range.location;
35 | }
36 |
37 | - (NSInteger)indexOf:(int)ch {
38 | // unichar c = (unichar) ch;
39 | // for(int i=0;i 0);
133 | }
134 |
135 | -(BOOL) matchesPatternRegexPattern:(NSString *)regex {
136 | return [self matchesPatternRegexPattern:regex caseInsensitive:NO treatAsOneLine:NO];
137 | }
138 |
139 | @end
140 |
--------------------------------------------------------------------------------
/Contacts/Classes/PinYin/PinyinFormatter.m:
--------------------------------------------------------------------------------
1 | //
2 | //
3 | //
4 | // Created by kimziv on 13-9-14.
5 | //
6 |
7 | #include "HanyuPinyinOutputFormat.h"
8 | #include "PinyinFormatter.h"
9 | #import "NSString+PinYin4Cocoa.h"
10 |
11 | @interface PinyinFormatter ()
12 | +(NSInteger)getNumericValue:(unichar)c;
13 | +(NSInteger)indexOfChar:(int*) table ch:(unichar)c;
14 | @end
15 |
16 | @implementation PinyinFormatter
17 |
18 | static int numericKeys[] = {
19 | 0x0030, 0x0041, 0x0061, 0x00b2, 0x00b9, 0x00bc, 0x0660, 0x06f0,
20 | 0x0966, 0x09e6, 0x09f4, 0x09f9, 0x0a66, 0x0ae6, 0x0b66, 0x0be7,
21 | 0x0bf1, 0x0bf2, 0x0c66, 0x0ce6, 0x0d66, 0x0e50, 0x0ed0, 0x0f20,
22 | 0x1040, 0x1369, 0x1373, 0x1374, 0x1375, 0x1376, 0x1377, 0x1378,
23 | 0x1379, 0x137a, 0x137b, 0x137c, 0x16ee, 0x17e0, 0x1810, 0x2070,
24 | 0x2074, 0x2080, 0x2153, 0x215f, 0x2160, 0x216c, 0x216d, 0x216e,
25 | 0x216f, 0x2170, 0x217c, 0x217d, 0x217e, 0x217f, 0x2180, 0x2181,
26 | 0x2182, 0x2460, 0x2474, 0x2488, 0x24ea, 0x2776, 0x2780, 0x278a,
27 | 0x3007, 0x3021, 0x3038, 0x3039, 0x303a, 0x3280, 0xff10, 0xff21,
28 | 0xff41,
29 | };
30 |
31 | static unichar numericValues[] = {
32 | 0x0039, 0x0030, 0x005a, 0x0037, 0x007a, 0x0057, 0x00b3, 0x00b0,
33 | 0x00b9, 0x00b8, 0x00be, 0x0000, 0x0669, 0x0660, 0x06f9, 0x06f0,
34 | 0x096f, 0x0966, 0x09ef, 0x09e6, 0x09f7, 0x09f3, 0x09f9, 0x09e9,
35 | 0x0a6f, 0x0a66, 0x0aef, 0x0ae6, 0x0b6f, 0x0b66, 0x0bf0, 0x0be6,
36 | 0x0bf1, 0x0b8d, 0x0bf2, 0x080a, 0x0c6f, 0x0c66, 0x0cef, 0x0ce6,
37 | 0x0d6f, 0x0d66, 0x0e59, 0x0e50, 0x0ed9, 0x0ed0, 0x0f29, 0x0f20,
38 | 0x1049, 0x1040, 0x1372, 0x1368, 0x1373, 0x135f, 0x1374, 0x1356,
39 | 0x1375, 0x134d, 0x1376, 0x1344, 0x1377, 0x133b, 0x1378, 0x1332,
40 | 0x1379, 0x1329, 0x137a, 0x1320, 0x137b, 0x1317, 0x137c, 0xec6c,
41 | 0x16f0, 0x16dd, 0x17e9, 0x17e0, 0x1819, 0x1810, 0x2070, 0x2070,
42 | 0x2079, 0x2070, 0x2089, 0x2080, 0x215e, 0x0000, 0x215f, 0x215e,
43 | 0x216b, 0x215f, 0x216c, 0x213a, 0x216d, 0x2109, 0x216e, 0x1f7a,
44 | 0x216f, 0x1d87, 0x217b, 0x216f, 0x217c, 0x214a, 0x217d, 0x2119,
45 | 0x217e, 0x1f8a, 0x217f, 0x1d97, 0x2180, 0x1d98, 0x2181, 0x0df9,
46 | 0x2182, 0xfa72, 0x2473, 0x245f, 0x2487, 0x2473, 0x249b, 0x2487,
47 | 0x24ea, 0x24ea, 0x277f, 0x2775, 0x2789, 0x277f, 0x2793, 0x2789,
48 | 0x3007, 0x3007, 0x3029, 0x3020, 0x3038, 0x302e, 0x3039, 0x3025,
49 | 0x303a, 0x301c, 0x3289, 0x327f, 0xff19, 0xff10, 0xff3a, 0xff17,
50 | 0xff5a, 0xff37,
51 | };
52 |
53 |
54 | + (NSString *)formatHanyuPinyinWithNSString:(NSString *)pinyinStr
55 | withHanyuPinyinOutputFormat:(HanyuPinyinOutputFormat *)outputFormat {
56 | if ((ToneTypeWithToneMark == [outputFormat toneType]) && ((VCharTypeWithV == [outputFormat vCharType]) || (VCharTypeWithUAndColon == [outputFormat vCharType]))) {
57 | @throw [NSException exceptionWithName:@"Throwing a BadHanyuPinyinOutputFormatCombination exception" reason:@"tone marks cannot be added to v or u:." userInfo:nil];
58 | }
59 | if (ToneTypeWithoutTone == [outputFormat toneType]) {
60 | pinyinStr =[pinyinStr stringByReplacingOccurrencesOfString:@"[1-5]" withString:@"" options:NSRegularExpressionSearch range:NSMakeRange(0, pinyinStr.length)];
61 | }
62 | else if (ToneTypeWithToneMark == [outputFormat toneType]) {
63 | pinyinStr =[pinyinStr stringByReplacingOccurrencesOfString:@"u:" withString:@"v"];
64 | pinyinStr = [PinyinFormatter convertToneNumber2ToneMarkWithNSString:pinyinStr];
65 | }
66 | if (VCharTypeWithV == [outputFormat vCharType]) {
67 | pinyinStr =[pinyinStr stringByReplacingOccurrencesOfString:@"u:" withString:@"v"];
68 | }
69 | else if (VCharTypeWithUUnicode == [outputFormat vCharType]) {
70 | pinyinStr =[pinyinStr stringByReplacingOccurrencesOfString:@"u:" withString:@"ü"];
71 | }
72 | if (CaseTypeUppercase == [outputFormat caseType]) {
73 | pinyinStr = [pinyinStr uppercaseString];
74 | }
75 | return pinyinStr;
76 | }
77 |
78 | + (NSString *)convertToneNumber2ToneMarkWithNSString:(NSString *)pinyinStr {
79 | NSString *lowerCasePinyinStr = [pinyinStr lowercaseString];
80 | if ([lowerCasePinyinStr matchesPatternRegexPattern:@"[a-z]*[1-5]?"]) {
81 | unichar defautlCharValue = '$';
82 | int defautlIndexValue = -1;
83 | unichar unmarkedVowel = defautlCharValue;
84 | int indexOfUnmarkedVowel = defautlIndexValue;
85 | unichar charA = 'a';
86 | unichar charE = 'e';
87 | NSString *ouStr = @"ou";
88 | NSString *allUnmarkedVowelStr = @"aeiouv";
89 | NSString *allMarkedVowelStr = @"āáăàaēéĕèeīíĭìiōóŏòoūúŭùuǖǘǚǜü";
90 | if ([lowerCasePinyinStr matchesPatternRegexPattern:@"[a-z]*[1-5]"]) {
91 | int tuneNumber = [PinyinFormatter getNumericValue:[lowerCasePinyinStr characterAtIndex:lowerCasePinyinStr.length -1]];
92 | int indexOfA = [lowerCasePinyinStr indexOf:charA];
93 | int indexOfE = [lowerCasePinyinStr indexOf:charE];
94 | int ouIndex = [lowerCasePinyinStr indexOfString:ouStr];
95 | if (-1 != indexOfA) {
96 | indexOfUnmarkedVowel = indexOfA;
97 | unmarkedVowel = charA;
98 | }
99 | else if (-1 != indexOfE) {
100 | indexOfUnmarkedVowel = indexOfE;
101 | unmarkedVowel = charE;
102 | }
103 | else if (-1 != ouIndex) {
104 | indexOfUnmarkedVowel = ouIndex;
105 | unmarkedVowel = [ouStr characterAtIndex:0];
106 | }
107 | else {
108 | for (int i = [lowerCasePinyinStr length] - 1; i >= 0; i--) {
109 | if ([[NSString valueOfChar:[lowerCasePinyinStr characterAtIndex:i]] matchesPatternRegexPattern:@"[aeiouv]"]) {
110 | indexOfUnmarkedVowel = i;
111 | unmarkedVowel = [lowerCasePinyinStr characterAtIndex:i];
112 | break;
113 | }
114 | }
115 | }
116 | if ((defautlCharValue != unmarkedVowel) && (defautlIndexValue != indexOfUnmarkedVowel)) {
117 | int rowIndex = [allUnmarkedVowelStr indexOf:unmarkedVowel];
118 | int columnIndex = tuneNumber - 1;
119 | int vowelLocation = rowIndex * 5 + columnIndex;
120 | unichar markedVowel = [allMarkedVowelStr characterAtIndex:vowelLocation];
121 | NSMutableString *resultBuffer = [[NSMutableString alloc] init];
122 | [resultBuffer appendString:[[lowerCasePinyinStr substringToIndex:indexOfUnmarkedVowel+1] stringByReplacingOccurrencesOfString:@"v" withString:@"ü"]];
123 | [resultBuffer appendFormat:@"%C",markedVowel];
124 | [resultBuffer appendString:[[lowerCasePinyinStr substringWithRange:NSMakeRange(indexOfUnmarkedVowel + 1, lowerCasePinyinStr.length-indexOfUnmarkedVowel)] stringByReplacingOccurrencesOfString:@"v" withString:@"ü"]];
125 | return [resultBuffer description];
126 | }
127 | else {
128 | return lowerCasePinyinStr;
129 | }
130 | }
131 | else {
132 | return [lowerCasePinyinStr stringByReplacingOccurrencesOfString:@"v" withString:@"ü"];
133 | }
134 | }
135 | else {
136 | return lowerCasePinyinStr;
137 | }
138 | }
139 |
140 | +(NSInteger)getNumericValue:(unichar)c
141 | {
142 | if (c < 128) {
143 | // Optimized for ASCII
144 | if (c >= '0' && c <= '9') {
145 | return c - '0';
146 | }
147 | if (c >= 'a' && c <= 'z') {
148 | return c - ('a' - 10);
149 | }
150 | if (c >= 'A' && c <= 'Z') {
151 | return c - ('A' - 10);
152 | }
153 | return -1;
154 | }
155 | NSInteger result = [self indexOfChar:numericKeys ch:c];
156 | if (result >= 0 && c <= numericValues[result * 2]) {
157 | unichar difference = numericValues[result * 2 + 1];
158 | if (difference == 0) {
159 | return -2;
160 | }
161 | // Value is always positive, must be negative value
162 | if (difference > c) {
163 | return c - (short) difference;
164 | }
165 | return c - difference;
166 | }
167 | return -1;
168 |
169 | }
170 |
171 | +(NSInteger)indexOfChar:(int*) table ch:(unichar)c{
172 | NSInteger len=sizeof(table)/sizeof(table[0]);
173 | for (int i = 0; i < len; i++) {
174 | if (table[i] == (int) c) {
175 | return i;
176 | }
177 | }
178 | return -1;
179 | }
180 |
181 |
182 | - (id)init {
183 | return [super init];
184 | }
185 |
186 |
187 |
188 | @end
189 |
--------------------------------------------------------------------------------
/Contacts/Classes/AddContact/AddContactsViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // AddContactsViewController.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "AddContactsViewController.h"
10 | #import "Contacts.h"
11 | #import "RecomendsCell.h"
12 | #import "ContactDetailViewController.h"
13 | #import "ChineseInclude.h"
14 | #import "PinYinForObjc.h"
15 |
16 |
17 | @implementation AddContactsViewController
18 |
19 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
20 | {
21 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
22 | if (self) {
23 | // Custom initialization
24 | }
25 | return self;
26 | }
27 |
28 |
29 | - (void)viewDidLoad
30 | {
31 | [super viewDidLoad];
32 | // Do any additional setup after loading the view.
33 | self.title = @"添加联系人";
34 |
35 | [self _initLayout];
36 |
37 | [self performSelector:@selector(loadrecomendsDatas) withObject:nil afterDelay:0.5];
38 |
39 | }
40 |
41 | - (void)_initLayout
42 | {
43 | newcontactsSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.view.frame.size.width, 44.0f)];
44 |
45 | newcontactsSearchBar.delegate = self;
46 | [newcontactsSearchBar setPlaceholder:@"搜索"];
47 | newcontactsSearchBar.keyboardType = UIKeyboardTypeDefault;
48 | // [self.view addSubview:newcontactsSearchBar];
49 |
50 | newsearchDisplayController = [[UISearchDisplayController alloc]initWithSearchBar:newcontactsSearchBar contentsController:self];
51 | newsearchDisplayController.active = NO;
52 | newsearchDisplayController.searchResultsDataSource = self;
53 | newsearchDisplayController.searchResultsDelegate = self;
54 |
55 |
56 | //self.recomended = [[UITableView alloc] initWithFrame:CGRectMake(0, 104, self.view.bounds.size.width, self.view.bounds.size.height)];
57 | self.recomended.delegate = self;
58 | self.recomended.dataSource = self;
59 | self.recomended.tableHeaderView = newcontactsSearchBar;
60 | [self.view addSubview:self.recomended];
61 |
62 | }
63 |
64 | - (void)loadrecomendsDatas
65 | {
66 | // json数据解析
67 | NSString *recomendsPath = [[NSBundle mainBundle] pathForResource:@"recomends" ofType:@"json"];
68 | NSData *data = [NSData dataWithContentsOfFile:recomendsPath];
69 | NSArray *array = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
70 | _recomendsArray = [[NSMutableArray alloc] init];
71 | for (int i = 0; i < array.count; i++) {
72 | Contacts *recontact = [[Contacts alloc] initWithPropertiesDictionary:array[i]];
73 | [_recomendsArray addObject:recontact];
74 | }
75 | [self.recomended reloadData];
76 |
77 | }
78 |
79 |
80 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
81 | {
82 | if (tableView == newsearchDisplayController.searchResultsTableView)
83 | {
84 | return nil;
85 | }
86 | else if(section == 0){
87 | return nil;
88 | }
89 | else{
90 | return @"可能认识的人";
91 | }
92 | }
93 |
94 | - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
95 | {
96 | if (tableView == newsearchDisplayController.searchResultsTableView)
97 | {
98 | return 1;
99 | }
100 | else return 2;
101 | }
102 |
103 | - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
104 | if (tableView == self.searchDisplayController.searchResultsTableView) // 有搜索
105 | {
106 | return newsearchResults.count;
107 | }
108 | else if(section == 0){
109 | return 2;
110 | }
111 | else{
112 | return _recomendsArray.count;
113 | }
114 | }
115 |
116 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
117 | {
118 | if (tableView == self.searchDisplayController.searchResultsTableView)
119 | {
120 | static NSString *CellIdentifier = @"RecomendsCell";
121 | RecomendsCell *cell = (RecomendsCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
122 |
123 | if (cell == nil){
124 | cell = [[[NSBundle mainBundle] loadNibNamed:@"RecomendsCell" owner:self options:nil] lastObject];
125 | }
126 | // 搜索结果显示
127 | Contacts *contact = newsearchResults[indexPath.row];
128 |
129 | NSString *nametext = [NSString stringWithFormat:@"%@",contact.name];
130 | NSString *addresstext = [NSString stringWithFormat:@"%@",contact.address];
131 | cell.tag = indexPath.row;
132 | cell.delegate = self;
133 |
134 | cell.nameLabel.text = nametext;
135 | cell.addressLabel.text = addresstext;
136 | UIButton *addbutton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
137 | [addbutton setFrame:CGRectMake(30.0, 0.0, 50, 28)];
138 | addbutton.titleLabel.font = [UIFont systemFontOfSize:15.0f];
139 | addbutton.titleLabel.textAlignment = NSTextAlignmentCenter;
140 | [addbutton setTitle:@"添加" forState:UIControlStateNormal];
141 | addbutton.tag = indexPath.row;
142 | [addbutton addTarget:self action:@selector(searchAddbtnClick:event:) forControlEvents:UIControlEventTouchUpInside];
143 | cell.accessoryView = addbutton;
144 | return cell;
145 |
146 | }
147 | else if(indexPath.section == 0){
148 | NSArray * titleArray= [[NSArray alloc] initWithObjects:@"添加手机联系人", @"添加微信好友",nil];
149 |
150 | static NSString *CellIdentifier = @"CellIdentifier";
151 |
152 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
153 | if (cell == nil) {
154 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: CellIdentifier];
155 | }
156 | NSUInteger row = [indexPath row];
157 | cell.textLabel.text = [titleArray objectAtIndex:row];
158 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
159 |
160 | return cell;
161 |
162 | }
163 | else{
164 |
165 | static NSString *CellIdentifier = @"RecomendsCell";
166 | RecomendsCell *cell = (RecomendsCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
167 |
168 | if (cell == nil){
169 | cell = [[[NSBundle mainBundle] loadNibNamed:@"RecomendsCell" owner:self options:nil] lastObject];
170 | }
171 | Contacts *contact = _recomendsArray[indexPath.row];
172 | NSString *nametext = [NSString stringWithFormat:@"%@",contact.name];
173 | NSString *addresstext = [NSString stringWithFormat:@"%@",contact.address];
174 | cell.tag = indexPath.row;
175 | cell.delegate = self;
176 | cell.nameLabel.text = nametext;
177 | cell.addressLabel.text = addresstext;
178 | UIButton *addbutton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
179 | [addbutton setFrame:CGRectMake(30.0, 0.0, 50, 28)];
180 | addbutton.titleLabel.font = [UIFont systemFontOfSize:15.0f];
181 | addbutton.titleLabel.textAlignment = NSTextAlignmentCenter;
182 | [addbutton setTitle:@"添加" forState:UIControlStateNormal];
183 | addbutton.tag = indexPath.row;
184 | [addbutton addTarget:self action:@selector(normalAddbtnClick:event:) forControlEvents:UIControlEventTouchUpInside];
185 | cell.accessoryView = addbutton;
186 | return cell;
187 | }
188 |
189 | }
190 |
191 | // cell上的 添加课程按钮, 响应事件, 搜索结果中的cell
192 | - (void)searchAddbtnClick:(id *)sender event:(id)event
193 | {
194 | NSSet *touches = [event allTouches];
195 | UITouch *touch = [touches anyObject];
196 | CGPoint currentTouchPosition = [touch locationInView:self.searchDisplayController.searchResultsTableView];
197 | NSIndexPath *indexPath = [self.searchDisplayController.searchResultsTableView indexPathForRowAtPoint: currentTouchPosition];
198 |
199 | if (indexPath != nil)
200 | {
201 | Contacts *newcontact = [newsearchResults objectAtIndex:indexPath.row];
202 |
203 | //第一步注册通知
204 | [[NSNotificationCenter defaultCenter]postNotificationName:@"addcontactNotification" object:newcontact];
205 |
206 | // [self tableView:self.recomended accessoryButtonTappedForRowWithIndexPath:indexPath];
207 | UITableViewCell *cell =[self.searchDisplayController.searchResultsTableView cellForRowAtIndexPath:indexPath];
208 | UIButton *button = (UIButton *)cell.accessoryView;
209 | [button setTitle:@"已添加" forState:UIControlStateNormal];
210 | }
211 |
212 | }
213 |
214 | // 添加课程按钮, 响应事件, table中的cell上的button
215 | - (void)normalAddbtnClick:(id *)sender event:(id)event
216 | {
217 |
218 | NSSet *touches = [event allTouches];
219 | UITouch *touch = [touches anyObject];
220 | CGPoint currentTouchPosition = [touch locationInView:self.recomended];
221 | NSIndexPath *indexPath = [self.recomended indexPathForRowAtPoint: currentTouchPosition];
222 |
223 | if (indexPath != nil)
224 | {
225 | Contacts *newcontact = [_recomendsArray objectAtIndex:indexPath.row];
226 |
227 | //第一步注册通知
228 | [[NSNotificationCenter defaultCenter]postNotificationName:@"addcontactNotification" object:newcontact];
229 |
230 | UITableViewCell *cell =[self.recomended cellForRowAtIndexPath:indexPath];
231 | UIButton *button = (UIButton *)cell.accessoryView;
232 | [button setTitle:@"已添加" forState:UIControlStateNormal];
233 |
234 | }
235 |
236 | }
237 |
238 |
239 | -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
240 | {
241 | if (tableView == self.searchDisplayController.searchResultsTableView){
242 | return 44;
243 |
244 | }
245 | else if(indexPath.section == 0){
246 |
247 | return 38;
248 |
249 | }
250 | else{
251 |
252 | return 44;
253 | }
254 |
255 | }
256 |
257 | //设置标题尾的宽度
258 | -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
259 | {
260 | return 0.01;
261 | }
262 |
263 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
264 | {
265 | // Return NO if you do not want the specified item to be editable.
266 | return YES;
267 | }
268 |
269 | // 选中某个cell
270 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
271 | {
272 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
273 |
274 | ContactDetailViewController *contactdetail = [[ContactDetailViewController alloc] init];
275 | if (tableView == self.searchDisplayController.searchResultsTableView) {
276 | contactdetail.contact = newsearchResults[indexPath.row];
277 |
278 | [self.navigationController pushViewController:contactdetail animated:YES];
279 | }
280 | else if(indexPath.section == 0){
281 | if(indexPath.row == 0){
282 |
283 | AddressBookViewController *ABviewcontroller = [[AddressBookViewController alloc] initWithNibName:@"AddressBookViewController" bundle:nil];
284 | ABviewcontroller.delegate = self;
285 | [self.navigationController pushViewController:ABviewcontroller animated:YES];
286 |
287 | }
288 | if (indexPath.row == 1){
289 | NSLog(@"weichat");
290 |
291 |
292 | }
293 | }
294 | else {
295 | contactdetail.contact = _recomendsArray[indexPath.row];
296 |
297 | [self.navigationController pushViewController:contactdetail animated:YES];
298 | }
299 |
300 | }
301 |
302 |
303 | #pragma UISearchDisplayDelegate
304 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
305 |
306 | newsearchResults = [[NSMutableArray alloc]init];
307 |
308 | if (newcontactsSearchBar.text.length>0&&![ChineseInclude isIncludeChineseInString:newcontactsSearchBar.text]) {
309 | for (int i=0; i< _recomendsArray.count; i++) {
310 |
311 | Contacts *recomend = _recomendsArray[i];
312 | if ([ChineseInclude isIncludeChineseInString:recomend.name]) {
313 | NSString *tempPinYinStr = [PinYinForObjc chineseConvertToPinYin:recomend.name];
314 | NSRange titleResult=[tempPinYinStr rangeOfString:newcontactsSearchBar.text options:NSCaseInsensitiveSearch];
315 |
316 | if (titleResult.length>0) {
317 | [newsearchResults addObject:recomend];
318 | }
319 | else {
320 | NSString *tempPinYinHeadStr = [PinYinForObjc chineseConvertToPinYinHead:recomend.name];
321 | NSRange titleHeadResult=[tempPinYinHeadStr rangeOfString:newcontactsSearchBar.text options:NSCaseInsensitiveSearch];
322 | if (titleHeadResult.length>0) {
323 | [newsearchResults addObject:recomend];
324 | }
325 | }
326 | NSString *tempPinYinHeadStr = [PinYinForObjc chineseConvertToPinYinHead:recomend.name];
327 | NSRange titleHeadResult=[tempPinYinHeadStr rangeOfString:newcontactsSearchBar.text options:NSCaseInsensitiveSearch];
328 | if (titleHeadResult.length>0) {
329 | [newsearchResults addObject:recomend];
330 | }
331 | }
332 | else {
333 | NSRange titleResult=[recomend.name rangeOfString:newcontactsSearchBar.text options:NSCaseInsensitiveSearch];
334 | if (titleResult.length>0) {
335 | [newsearchResults addObject:recomend]; // 搜索结果
336 | }
337 | }
338 | }
339 | } else if (newcontactsSearchBar.text.length>0&&[ChineseInclude isIncludeChineseInString:newcontactsSearchBar.text]) {
340 |
341 | for (int i=0; i< _recomendsArray.count; i++) {
342 |
343 | Contacts *recomend = _recomendsArray[i];
344 | NSString *tempStr = recomend.name;
345 | NSRange titleResult=[tempStr rangeOfString:newcontactsSearchBar.text options:NSCaseInsensitiveSearch];
346 | if (titleResult.length>0) {
347 | [newsearchResults addObject:recomend];
348 | }
349 |
350 | }
351 | }
352 |
353 | }
354 |
355 |
356 |
357 | @end
358 |
--------------------------------------------------------------------------------
/Contacts/Classes/ContactsView/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/18.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "ViewController.h"
11 | #import "ContactsTableView.h"
12 | #import "AddContactsViewController.h"
13 | #import "ContactDetailViewController.h"
14 | #import "ChineseInclude.h"
15 | #import "PinYinForObjc.h"
16 | #import "Contacts.h"
17 | #import "ContactCell.h"
18 | #import "PinYinForObjc.h"
19 |
20 | @interface ViewController ()
21 |
22 | @property (nonatomic, strong) ContactsTableView *contactTableView;
23 | @property (nonatomic, strong) NSMutableArray *contactArraytemp; //从数据库读取的contacts数据
24 | @property (nonatomic, strong) NSMutableArray *allArray; // 包含空数据的contactsArray
25 | @property (nonatomic, strong) NSMutableArray *dataSource; // 核心数据
26 | @property (nonatomic, strong) NSMutableArray *indexTitles;
27 |
28 | @end
29 |
30 | @implementation ViewController
31 |
32 |
33 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
34 | {
35 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
36 | if (self) {
37 | // Custom initialization
38 | }
39 | return self;
40 | }
41 |
42 | // 创建tableView
43 | - (void) createTableView {
44 | self.contactTableView = [[ContactsTableView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
45 | self.contactTableView.delegate = self;
46 | self.contactTableView.tableView.tableHeaderView = contactsSearchBar;
47 | [self.view addSubview:self.contactTableView];
48 | }
49 |
50 | - (void) reloadTableView {
51 | self.contactTableView = [[ContactsTableView alloc] initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, self.view.bounds.size.height-64)];
52 | self.contactTableView.delegate = self;
53 | self.contactTableView.tableView.tableHeaderView = contactsSearchBar;
54 | [self.view addSubview:self.contactTableView];
55 | }
56 | - (void)viewDidLoad {
57 | [super viewDidLoad];
58 | self.title = @"联系人";
59 |
60 | self.dataSource = [[NSMutableArray alloc] init];
61 | self.contactArraytemp = [[NSMutableArray alloc] init];
62 | self.allArray = [[NSMutableArray alloc] init];
63 | // Do any additional setup after loading the view, typically from a nib.
64 |
65 | contactsSearchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, 40)];
66 | contactsSearchBar.delegate = self;
67 | [contactsSearchBar setPlaceholder:@"搜索联系人"];
68 | contactsSearchBar.keyboardType = UIKeyboardTypeDefault;
69 | searchDisplayController = [[UISearchDisplayController alloc]initWithSearchBar:contactsSearchBar contentsController:self];
70 | searchDisplayController.active = NO;
71 | searchDisplayController.searchResultsDataSource = self;
72 | searchDisplayController.searchResultsDelegate = self;
73 |
74 | [self performSelector:@selector(loadLocalData)];
75 |
76 | [self createTableView];
77 |
78 | // 左侧 添加联系人按钮
79 | UIButton *addcontactsButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
80 | addcontactsButton.frame = CGRectMake(0, 0, 30, 30);
81 | // addcontactsButton.titleLabel.font = [UIFont systemFontOfSize:16.0f];
82 | // addcontactsButton.titleLabel.textAlignment = NSTextAlignmentCenter;
83 | [addcontactsButton setTitle:@"添加" forState:UIControlStateNormal];
84 | [addcontactsButton addTarget:self action:@selector(addcontactsAction) forControlEvents:UIControlEventTouchUpInside];
85 | UIBarButtonItem *addcontactsItem = [[UIBarButtonItem alloc] initWithCustomView:addcontactsButton];
86 | self.navigationItem.rightBarButtonItem = addcontactsItem;
87 |
88 | // 添加通知中心, 添加联系人
89 | [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(addnewcontact:) name:@"addcontactNotification" object:nil];
90 |
91 |
92 | }
93 |
94 | - (void)loadLocalData
95 | {
96 |
97 | // json数据解析
98 | NSString *contactPath = [[NSBundle mainBundle] pathForResource:@"contacts1" ofType:@"json"];
99 | NSData *data = [NSData dataWithContentsOfFile:contactPath];
100 | NSArray *array = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingAllowFragments error:nil];
101 |
102 | self.contactArraytemp = [[NSMutableArray alloc] init];
103 | for (int i = 0; i < array.count; i++) {
104 | Contacts *contact = [[Contacts alloc] initWithPropertiesDictionary:array[i]];
105 | [self.contactArraytemp addObject:contact];
106 | }
107 |
108 |
109 | // 对数据进行排序,并按首字母分类
110 | UILocalizedIndexedCollation *theCollation = [UILocalizedIndexedCollation currentCollation];
111 | for (Contacts *contact in self.contactArraytemp) {
112 | NSInteger sect = [theCollation sectionForObject:contact
113 | collationStringSelector:@selector(name)];
114 | contact.sectionNumber = sect;
115 |
116 | }
117 |
118 | NSInteger highSection = [[theCollation sectionTitles] count];
119 | NSMutableArray *sectionArrays = [NSMutableArray arrayWithCapacity:highSection];
120 | for (int i=0; i<=highSection; i++) {
121 | NSMutableArray *sectionArray = [NSMutableArray arrayWithCapacity:1];
122 | [sectionArrays addObject:sectionArray];
123 | }
124 |
125 | for (Contacts *contact in self.contactArraytemp) {
126 | [(NSMutableArray *)[sectionArrays objectAtIndex:contact.sectionNumber] addObject:contact];
127 | }
128 |
129 | self.allArray = [[NSMutableArray alloc] init];
130 | for (NSMutableArray *sectionArray in sectionArrays) {
131 | NSArray *sortedSection = [theCollation sortedArrayFromArray:sectionArray collationStringSelector:@selector(name)];
132 | [self.allArray addObject:sortedSection];
133 | }
134 |
135 | // 只取有数据的Array
136 | for (NSMutableArray *sectionArray0 in self.allArray) {
137 | if (sectionArray0.count) {
138 | [self.dataSource addObject:sectionArray0];
139 | }
140 |
141 | }
142 |
143 | }
144 |
145 |
146 |
147 | - (void)didReceiveMemoryWarning {
148 | [super didReceiveMemoryWarning];
149 | // Dispose of any resources that can be recreated.
150 | }
151 |
152 | // 添加联系人
153 | - (void)addcontactsAction
154 | {
155 | AddContactsViewController* addcontact = [[AddContactsViewController alloc] initWithNibName:@"AddContactsViewController" bundle:nil];
156 |
157 | [self.navigationController pushViewController:addcontact animated:YES];
158 |
159 | }
160 |
161 |
162 | - (void)addnewcontact:(NSNotification *)notification
163 | {
164 | Contacts *newcontact = notification.object;
165 | NSString *name = newcontact.name;
166 |
167 | NSLog(@"添加联系人%@",name);
168 | [self.contactArraytemp addObject:newcontact];
169 |
170 | // 数据更新
171 | self.dataSource = [[NSMutableArray alloc] init];
172 | self.allArray = [[NSMutableArray alloc] init];
173 | UILocalizedIndexedCollation *theCollation = [UILocalizedIndexedCollation currentCollation];
174 | for (Contacts *contact in self.contactArraytemp) {
175 | NSInteger sect = [theCollation sectionForObject:contact
176 | collationStringSelector:@selector(name)];
177 | contact.sectionNumber = sect;
178 |
179 | }
180 |
181 | NSInteger highSection = [[theCollation sectionTitles] count];
182 | NSMutableArray *sectionArrays = [NSMutableArray arrayWithCapacity:highSection];
183 | for (int i=0; i<=highSection; i++) {
184 | NSMutableArray *sectionArray = [NSMutableArray arrayWithCapacity:1];
185 | [sectionArrays addObject:sectionArray];
186 | }
187 |
188 | for (Contacts *contact in self.contactArraytemp) {
189 | [(NSMutableArray *)[sectionArrays objectAtIndex:contact.sectionNumber] addObject:contact];
190 | }
191 |
192 | self.allArray = [[NSMutableArray alloc] init];
193 | for (NSMutableArray *sectionArray in sectionArrays) {
194 | NSArray *sortedSection = [theCollation sortedArrayFromArray:sectionArray collationStringSelector:@selector(name)];
195 | [self.allArray addObject:sortedSection];
196 | }
197 |
198 | // 只取有数据的Array
199 | for (NSMutableArray *sectionArray0 in self.allArray) {
200 | if (sectionArray0.count) {
201 | [self.dataSource addObject:sectionArray0];
202 | }
203 |
204 | }
205 | [self reloadTableView];
206 |
207 | }
208 |
209 |
210 |
211 | //#pragma mark - UITableViewDataSource
212 | // IndexTable
213 | - (NSArray *) sectionIndexTitlesForABELTableView:(ContactsTableView *)tableView
214 | {
215 | if (tableView == searchDisplayController.searchResultsTableView)
216 | {
217 | return nil;
218 | }
219 | else{
220 | self.indexTitles = [NSMutableArray array];
221 |
222 | for (int i = 0; i < self.allArray.count; i++) {
223 | if ([[self.allArray objectAtIndex:i] count]) {
224 | [self.indexTitles addObject:[[[UILocalizedIndexedCollation currentCollation] sectionTitles] objectAtIndex:i]];
225 | }
226 | }
227 |
228 | return self.indexTitles;
229 |
230 | }
231 |
232 | }
233 |
234 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
235 | {
236 | if (tableView == searchDisplayController.searchResultsTableView)
237 | {
238 | return nil;
239 | }
240 | else{
241 |
242 | return [self.indexTitles objectAtIndex:section];
243 | }
244 | }
245 |
246 | - (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
247 | if (tableView == searchDisplayController.searchResultsTableView)
248 | {
249 | return 1;
250 | }
251 | else{
252 | return self.dataSource.count;
253 |
254 | }
255 |
256 | }
257 |
258 | - (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
259 | if (tableView == self.searchDisplayController.searchResultsTableView) // 有搜索
260 | {
261 | return searchResults.count;
262 | }
263 | else{
264 | return [[self.dataSource objectAtIndex:section] count];
265 | }
266 |
267 | }
268 |
269 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
270 |
271 | static NSString *CellIdentifier = @"ContactCell";
272 | ContactCell *cell = (ContactCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
273 |
274 | if (cell == nil){
275 | cell = [[[NSBundle mainBundle] loadNibNamed:@"ContactCell" owner:self options:nil] lastObject];
276 | }
277 |
278 | if (tableView == self.searchDisplayController.searchResultsTableView)
279 | {
280 | // 搜索结果显示
281 | Contacts *contact = searchResults[indexPath.row];
282 |
283 | NSString *nametext = [NSString stringWithFormat:@"%@",contact.name];
284 |
285 | cell.tag = indexPath.row;
286 | cell.delegate = self;
287 |
288 | cell.nameLabel.text = nametext;
289 |
290 | }
291 | else {
292 |
293 | Contacts *contact = (Contacts *)[[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
294 | NSString *nametext = [NSString stringWithFormat:@"%@",contact.name];
295 |
296 | cell.tag = indexPath.row;
297 | cell.delegate = self;
298 | cell.nameLabel.text = nametext;
299 | }
300 |
301 | return cell;
302 |
303 | }
304 |
305 | - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
306 | {
307 | // Return NO if you do not want the specified item to be editable.
308 | return YES;
309 | }
310 |
311 |
312 | // 选中某个cell,进入 detailcontact 联系人详情页面
313 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
314 | {
315 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
316 |
317 | ContactDetailViewController *contactdetail = [[ContactDetailViewController alloc] init];
318 | if (tableView == self.searchDisplayController.searchResultsTableView) {
319 | contactdetail.contact = searchResults[indexPath.row];
320 | }
321 | else {
322 |
323 | contactdetail.contact = (Contacts *)[[self.dataSource objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
324 |
325 | }
326 |
327 | [self.navigationController pushViewController:contactdetail animated:YES];
328 | }
329 |
330 | // 联系人搜索,可实现汉字搜索,汉语拼音搜索和拼音首字母搜索,
331 | // 输入联系人名称,进行搜索, 返回搜索结果searchResults
332 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
333 | {
334 | searchResults = [[NSMutableArray alloc]init];
335 | if (contactsSearchBar.text.length>0&&![ChineseInclude isIncludeChineseInString:contactsSearchBar.text]) {
336 | for (NSArray *section in self.dataSource) {
337 | for (Contacts *contact in section)
338 | {
339 |
340 | if ([ChineseInclude isIncludeChineseInString:contact.name]) {
341 | NSString *tempPinYinStr = [PinYinForObjc chineseConvertToPinYin:contact.name];
342 | NSRange titleResult=[tempPinYinStr rangeOfString:contactsSearchBar.text options:NSCaseInsensitiveSearch];
343 |
344 | if (titleResult.length>0) {
345 | [searchResults addObject:contact];
346 | }
347 | else {
348 | NSString *tempPinYinHeadStr = [PinYinForObjc chineseConvertToPinYinHead:contact.name];
349 | NSRange titleHeadResult=[tempPinYinHeadStr rangeOfString:contactsSearchBar.text options:NSCaseInsensitiveSearch];
350 | if (titleHeadResult.length>0) {
351 | [searchResults addObject:contact];
352 | }
353 | }
354 | NSString *tempPinYinHeadStr = [PinYinForObjc chineseConvertToPinYinHead:contact.name];
355 | NSRange titleHeadResult=[tempPinYinHeadStr rangeOfString:contactsSearchBar.text options:NSCaseInsensitiveSearch];
356 | if (titleHeadResult.length>0) {
357 | [searchResults addObject:contact];
358 | }
359 | }
360 | else {
361 | NSRange titleResult=[contact.name rangeOfString:contactsSearchBar.text options:NSCaseInsensitiveSearch];
362 | if (titleResult.length>0) {
363 | [searchResults addObject:contact];
364 | }
365 | }
366 | }
367 | }
368 | } else if (contactsSearchBar.text.length>0&&[ChineseInclude isIncludeChineseInString:contactsSearchBar.text]) {
369 |
370 | for (NSArray *section in self.dataSource) {
371 | for (Contacts *contact in section)
372 | {
373 | NSString *tempStr = contact.name;
374 | NSRange titleResult=[tempStr rangeOfString:contactsSearchBar.text options:NSCaseInsensitiveSearch];
375 | if (titleResult.length>0) {
376 | [searchResults addObject:contact];
377 | }
378 |
379 | }
380 | }
381 | }
382 |
383 | }
384 |
385 |
386 |
387 |
388 | // searchbar 点击上浮,完毕复原
389 | -(BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
390 | {
391 | //准备搜索前,把上面调整的TableView调整回全屏幕的状态
392 | [UIView animateWithDuration:1.0 animations:^{
393 | self.contactTableView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
394 |
395 | }];
396 | return YES;
397 | }
398 | -(BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar
399 | {
400 | //搜索结束后,恢复原状
401 | [UIView animateWithDuration:1.0 animations:^{
402 | self.contactTableView.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height);
403 | }];
404 | return YES;
405 | }
406 |
407 |
408 |
409 |
410 | @end
411 |
--------------------------------------------------------------------------------
/Contacts/Classes/ABContacts/AddressBookViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // AddressBookViewController.m
3 | // Contacts
4 | //
5 | // Created by emma on 15/6/25.
6 | // Copyright (c) 2015年 Emma. All rights reserved.
7 | //
8 |
9 | #import "AddressBookViewController.h"
10 | #import "NSString+TKUtilities.h"
11 | #import "UIImage+TKUtilities.h"
12 | #import "ChineseInclude.h"
13 | #import "PinYinForObjc.h"
14 | #import "Contacts.h"
15 | #import "ContactDetailViewController.h"
16 |
17 | @interface AddressBookViewController ()
18 |
19 | @end
20 |
21 | @implementation AddressBookViewController
22 | @synthesize tableView = _tableView;
23 | @synthesize delegate = _delegate;
24 | @synthesize savedSearchTerm = _savedSearchTerm;
25 | @synthesize savedScopeButtonIndex = _savedScopeButtonIndex;
26 | @synthesize searchWasActive = _searchWasActive;
27 | //@synthesize ABsearchBar = _ABsearchBar;
28 |
29 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
30 | {
31 | if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
32 | _listContent = [NSMutableArray new];
33 |
34 | }
35 | return self;
36 | }
37 |
38 | - (void)viewDidLoad {
39 | [super viewDidLoad];
40 | // Do any additional setup after loading the view.
41 | self.title = @"通讯录朋友";
42 |
43 |
44 | ABsearchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 64, self.view.bounds.size.width, 40)];
45 | ABsearchBar.delegate = self;
46 | [ABsearchBar setPlaceholder:@"搜索"];
47 | ABsearchBar.keyboardType = UIKeyboardTypeDefault;
48 |
49 | ABsearchDisplayController = [[UISearchDisplayController alloc]initWithSearchBar:ABsearchBar contentsController:self];
50 | ABsearchDisplayController.active = NO;
51 | ABsearchDisplayController.searchResultsDataSource = self;
52 | ABsearchDisplayController.searchResultsDelegate = self;
53 |
54 | self.tableView.dataSource = self;
55 | self.tableView.delegate = self;
56 | self.tableView.tableHeaderView = ABsearchBar;
57 |
58 | [self.view addSubview:self.tableView];
59 |
60 |
61 | // Create addressbook data model
62 | NSMutableArray *addressBookTemp = [NSMutableArray array];
63 | CFErrorRef error = NULL;
64 | ABAddressBookRef addressBooks = ABAddressBookCreateWithOptions(NULL, &error);
65 |
66 | dispatch_semaphore_t sema = dispatch_semaphore_create(0);//发出访问通讯录的请求
67 | ABAddressBookRequestAccessWithCompletion(addressBooks, ^(bool granted, CFErrorRef error) {
68 | dispatch_semaphore_signal(sema);
69 | });
70 |
71 | dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER);
72 |
73 |
74 | CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(addressBooks);
75 | CFIndex nPeople = ABAddressBookGetPersonCount(addressBooks);
76 |
77 |
78 | for (NSInteger i = 0; i < nPeople; i++)
79 | {
80 | ABAddressBook *addressBook = [[ABAddressBook alloc] init];
81 | ABRecordRef person = CFArrayGetValueAtIndex(allPeople, i);
82 | CFStringRef abName = ABRecordCopyValue(person, kABPersonFirstNameProperty);
83 | CFStringRef abLastName = ABRecordCopyValue(person, kABPersonLastNameProperty);
84 | CFStringRef abFullName = ABRecordCopyCompositeName(person);
85 |
86 |
87 | NSString *nameString = (__bridge NSString *)abName;
88 | NSString *lastNameString = (__bridge NSString *)abLastName;
89 |
90 | if ((__bridge id)abFullName != nil) {
91 | nameString = (__bridge NSString *)abFullName;
92 | } else {
93 | if ((__bridge id)abLastName != nil)
94 | {
95 | nameString = [NSString stringWithFormat:@"%@ %@", nameString, lastNameString];
96 | }
97 | }
98 |
99 | addressBook.name = nameString;
100 | addressBook.recordID = (int)ABRecordGetRecordID(person);;
101 | addressBook.rowSelected = NO; // addressbook 某一行是否被选中
102 |
103 | ABPropertyID multiProperties[] = {
104 | kABPersonPhoneProperty, // 电话
105 | kABPersonEmailProperty // 邮件
106 | };
107 | NSInteger multiPropertiesTotal = sizeof(multiProperties) / sizeof(ABPropertyID);
108 | for (NSInteger j = 0; j < multiPropertiesTotal; j++) {
109 | ABPropertyID property = multiProperties[j];
110 | ABMultiValueRef valuesRef = ABRecordCopyValue(person, property);
111 | NSInteger valuesCount = 0;
112 | if (valuesRef != nil) valuesCount = ABMultiValueGetCount(valuesRef);
113 |
114 | if (valuesCount == 0) {
115 | CFRelease(valuesRef);
116 | continue;
117 | }
118 |
119 | for (NSInteger k = 0; k < valuesCount; k++) {
120 | CFStringRef value = ABMultiValueCopyValueAtIndex(valuesRef, k);
121 | switch (j) {
122 | case 0: {// Phone number
123 | addressBook.tel = [(__bridge NSString*)value initTelephoneWithReformat];
124 | break;
125 | }
126 | case 1: {// Email
127 | addressBook.email = (__bridge NSString*)value;
128 | break;
129 | }
130 | }
131 | CFRelease(value);
132 | }
133 | CFRelease(valuesRef);
134 | }
135 |
136 | [addressBookTemp addObject:addressBook];
137 |
138 | if (abName) CFRelease(abName);
139 | if (abLastName) CFRelease(abLastName);
140 | if (abFullName) CFRelease(abFullName);
141 | }
142 |
143 | CFRelease(allPeople);
144 | CFRelease(addressBooks);
145 |
146 | // 对数据进行排序,并按首字母分类
147 | UILocalizedIndexedCollation *theCollation = [UILocalizedIndexedCollation currentCollation];
148 | for (ABAddressBook *addressBook in addressBookTemp) {
149 | NSInteger sect = [theCollation sectionForObject:addressBook
150 | collationStringSelector:@selector(name)];
151 | addressBook.sectionNumber = sect;
152 |
153 | }
154 |
155 | NSInteger highSection = [[theCollation sectionTitles] count];
156 | NSMutableArray *sectionArrays = [NSMutableArray arrayWithCapacity:highSection];
157 | for (int i=0; i<=highSection; i++) {
158 | NSMutableArray *sectionArray = [NSMutableArray arrayWithCapacity:1];
159 | [sectionArrays addObject:sectionArray];
160 | }
161 |
162 | for (ABAddressBook *addressBook in addressBookTemp) {
163 | [(NSMutableArray *)[sectionArrays objectAtIndex:addressBook.sectionNumber] addObject:addressBook];
164 | }
165 |
166 | for (NSMutableArray *sectionArray in sectionArrays) {
167 | NSArray *sortedSection = [theCollation sortedArrayFromArray:sectionArray collationStringSelector:@selector(name)];
168 | [_listContent addObject:sortedSection];
169 | }
170 |
171 |
172 | }
173 |
174 | - (void)didReceiveMemoryWarning {
175 | [super didReceiveMemoryWarning];
176 | // Dispose of any resources that can be recreated.
177 | }
178 |
179 | #pragma mark -
180 | #pragma mark UITableViewDataSource & UITableViewDelegate
181 |
182 | - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
183 | {
184 | if (tableView == self.searchDisplayController.searchResultsTableView) {
185 | return 0;
186 | } else {
187 | if (title == UITableViewIndexSearch) {
188 | [tableView scrollRectToVisible:self.searchDisplayController.searchBar.frame animated:NO];
189 | return -1;
190 | } else {
191 | return [[UILocalizedIndexedCollation currentCollation] sectionForSectionIndexTitleAtIndex:index-1];
192 | }
193 | }
194 | }
195 |
196 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
197 | {
198 | if (tableView == self.searchDisplayController.searchResultsTableView) {
199 | return 1;
200 | } else {
201 | return [_listContent count];
202 | }
203 | }
204 |
205 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
206 | {
207 | if (tableView == self.searchDisplayController.searchResultsTableView) {
208 | return nil;
209 | } else {
210 | return [[_listContent objectAtIndex:section] count] ? [[[UILocalizedIndexedCollation currentCollation] sectionTitles] objectAtIndex:section] : nil;
211 | }
212 | }
213 |
214 | - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
215 | {
216 | if (tableView == self.searchDisplayController.searchResultsTableView)
217 | return 0;
218 | return [[_listContent objectAtIndex:section] count] ? tableView.sectionHeaderHeight : 0;
219 | }
220 |
221 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
222 | {
223 | if (tableView == self.searchDisplayController.searchResultsTableView) {
224 | return [_filteredListContent count];
225 | } else {
226 | return [[_listContent objectAtIndex:section] count];
227 | }
228 | }
229 |
230 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
231 | {
232 | static NSString *kCustomCellID = @"ControllerCell";
233 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCustomCellID];
234 |
235 | if (cell == nil)
236 | {
237 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kCustomCellID];
238 | cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
239 | cell.selectionStyle = UITableViewCellSelectionStyleNone;
240 | }
241 |
242 | ABAddressBook *addressBook = nil;
243 | if (tableView == self.searchDisplayController.searchResultsTableView){
244 | addressBook = (ABAddressBook *)[_filteredListContent objectAtIndex:indexPath.row];
245 |
246 | if ([[addressBook.name stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] > 0) {
247 | cell.textLabel.text = addressBook.name;
248 | } else {
249 | cell.textLabel.font = [UIFont italicSystemFontOfSize:cell.textLabel.font.pointSize];
250 | cell.textLabel.text = @"No Name";
251 | }
252 |
253 | UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
254 | [button setFrame:CGRectMake(30.0, 0.0, 50, 28)];
255 | button.titleLabel.font = [UIFont systemFontOfSize:15.0f];
256 | button.titleLabel.textAlignment = NSTextAlignmentCenter;
257 | button.tag = indexPath.row;
258 | [button setTitle:@"添加" forState:UIControlStateNormal];
259 |
260 | [button addTarget:self action:@selector(searchAddButtonTapped:event:) forControlEvents:UIControlEventTouchUpInside];
261 |
262 | cell.accessoryView = button;
263 |
264 |
265 | }
266 | else{
267 | addressBook = (ABAddressBook *)[[_listContent objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
268 |
269 | if ([[addressBook.name stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] length] > 0) {
270 | cell.textLabel.text = addressBook.name;
271 | } else {
272 | cell.textLabel.font = [UIFont italicSystemFontOfSize:cell.textLabel.font.pointSize];
273 | cell.textLabel.text = @"No Name";
274 | }
275 |
276 | UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
277 | [button setFrame:CGRectMake(30.0, 0.0, 50, 28)];
278 | button.titleLabel.font = [UIFont systemFontOfSize:15.0f];
279 | button.titleLabel.textAlignment = NSTextAlignmentCenter;
280 | button.tag = indexPath.row;
281 | [button setTitle:@"添加" forState:UIControlStateNormal];
282 |
283 | [button addTarget:self action:@selector(normalAddButtonTapped:event:) forControlEvents:UIControlEventTouchUpInside];
284 |
285 | cell.accessoryView = button;
286 |
287 | }
288 |
289 | return cell;
290 | }
291 |
292 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
293 | {
294 |
295 | [tableView deselectRowAtIndexPath:indexPath animated:YES];
296 |
297 | ContactDetailViewController *contactdetail = [[ContactDetailViewController alloc] init];
298 | if (tableView == self.searchDisplayController.searchResultsTableView) {
299 | contactdetail.contact = _filteredListContent[indexPath.row];
300 | }
301 | else {
302 | contactdetail.contact = (Contacts *)[[_listContent objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
303 |
304 | }
305 | [self.navigationController pushViewController:contactdetail animated:YES];
306 |
307 | }
308 |
309 |
310 | - (void)normalAddButtonTapped:(id *)sender event:(id)event
311 | {
312 |
313 | NSSet *touches = [event allTouches];
314 | UITouch *touch = [touches anyObject];
315 | CGPoint currentTouchPosition = [touch locationInView:self.tableView];
316 | NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
317 |
318 | if (indexPath != nil)
319 | {
320 | Contacts *newcontact = [[_listContent objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
321 | //第一步注册通知
322 |
323 | [[NSNotificationCenter defaultCenter]postNotificationName:@"addcontactNotification" object:newcontact];
324 |
325 | //[self tableView:self.tableView accessoryButtonTappedForRowWithIndexPath:indexPath];
326 | UITableViewCell *cell =[self.tableView cellForRowAtIndexPath:indexPath];
327 | UIButton *button = (UIButton *)cell.accessoryView;
328 | [button setTitle:@"已添加" forState:UIControlStateNormal];
329 |
330 | }
331 |
332 | }
333 |
334 | - (void)searchAddButtonTapped:(id *)sender event:(id)event
335 | {
336 | NSSet *touches = [event allTouches];
337 | UITouch *touch = [touches anyObject];
338 | CGPoint currentTouchPosition = [touch locationInView:self.searchDisplayController.searchResultsTableView];
339 | NSIndexPath *indexPath = [self.searchDisplayController.searchResultsTableView indexPathForRowAtPoint: currentTouchPosition];
340 |
341 | if (indexPath != nil)
342 | {
343 | Contacts *newcontact = [_filteredListContent objectAtIndex:indexPath.row];
344 | //第一步注册通知
345 |
346 | [[NSNotificationCenter defaultCenter]postNotificationName:@"addcontactNotification" object:newcontact];
347 |
348 | // [self tableView:self.searchDisplayController.searchResultsTableView accessoryButtonTappedForRowWithIndexPath:indexPath];
349 | UITableViewCell *cell =[self.searchDisplayController.searchResultsTableView cellForRowAtIndexPath:indexPath];
350 | UIButton *button = (UIButton *)cell.accessoryView;
351 | [button setTitle:@"已添加" forState:UIControlStateNormal];
352 | }
353 | }
354 |
355 | #pragma mark -
356 | #pragma mark Save action
357 |
358 |
359 | //#pragma UISearchDisplayDelegate
360 |
361 | - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
362 | {
363 | _filteredListContent = [[NSMutableArray alloc]init];
364 |
365 | if (ABsearchBar.text.length>0&&![ChineseInclude isIncludeChineseInString:ABsearchBar.text]) {
366 | for (NSArray *section in _listContent) {
367 | for (ABAddressBook *addressBook in section)
368 | {
369 |
370 | if ([ChineseInclude isIncludeChineseInString:addressBook.name]) {
371 | NSString *tempPinYinStr = [PinYinForObjc chineseConvertToPinYin:addressBook.name];
372 | NSRange titleResult=[tempPinYinStr rangeOfString:ABsearchBar.text options:NSCaseInsensitiveSearch];
373 |
374 | if (titleResult.length>0) {
375 | [_filteredListContent addObject:addressBook];
376 | }
377 | else {
378 | NSString *tempPinYinHeadStr = [PinYinForObjc chineseConvertToPinYinHead:addressBook.name];
379 | NSRange titleHeadResult=[tempPinYinHeadStr rangeOfString:ABsearchBar.text options:NSCaseInsensitiveSearch];
380 | if (titleHeadResult.length>0) {
381 | [_filteredListContent addObject:addressBook];
382 | }
383 | }
384 | NSString *tempPinYinHeadStr = [PinYinForObjc chineseConvertToPinYinHead:addressBook.name];
385 | NSRange titleHeadResult=[tempPinYinHeadStr rangeOfString:ABsearchBar.text options:NSCaseInsensitiveSearch];
386 | if (titleHeadResult.length>0) {
387 | [_filteredListContent addObject:addressBook];
388 | }
389 | }
390 | else {
391 | NSRange titleResult=[addressBook.name rangeOfString:ABsearchBar.text options:NSCaseInsensitiveSearch];
392 | if (titleResult.length>0) {
393 | [_filteredListContent addObject:addressBook];
394 | }
395 | }
396 | }
397 | }
398 | } else if (ABsearchBar.text.length>0&&[ChineseInclude isIncludeChineseInString:ABsearchBar.text]) {
399 |
400 | for (NSArray *section in _listContent) {
401 | for (ABAddressBook *addressBook in section)
402 | {
403 |
404 | NSString *tempStr = addressBook.name;
405 | NSRange titleResult=[tempStr rangeOfString:ABsearchBar.text options:NSCaseInsensitiveSearch];
406 | if (titleResult.length>0) {
407 | [_filteredListContent addObject:addressBook];
408 | }
409 |
410 | }
411 | }
412 | }
413 |
414 | }
415 |
416 |
417 |
418 | @end
419 |
--------------------------------------------------------------------------------
/Contacts.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | B50357E61B3C2A070068C867 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50357E51B3C2A070068C867 /* AddressBook.framework */; };
11 | B50357E81B3C2A0F0068C867 /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50357E71B3C2A0F0068C867 /* AddressBookUI.framework */; };
12 | B50357EA1B3C2A230068C867 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B50357E91B3C2A230068C867 /* QuartzCore.framework */; };
13 | B50358201B3CF9470068C867 /* note_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = B503581F1B3CF9470068C867 /* note_bg.png */; };
14 | B55AA70A1B40EB70009E46A1 /* contacts1.json in Resources */ = {isa = PBXBuildFile; fileRef = B55AA7091B40EB70009E46A1 /* contacts1.json */; };
15 | B56592681B33D6920088EEEE /* touxiang1.png in Resources */ = {isa = PBXBuildFile; fileRef = B56592661B33D6920088EEEE /* touxiang1.png */; };
16 | B56592731B3407830088EEEE /* recomends.json in Resources */ = {isa = PBXBuildFile; fileRef = B56592721B3407830088EEEE /* recomends.json */; };
17 | B565927C1B340CFB0088EEEE /* touxiang2.png in Resources */ = {isa = PBXBuildFile; fileRef = B565927B1B340CFB0088EEEE /* touxiang2.png */; };
18 | B59715ED1B32B6E8006DCCA9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B59715EC1B32B6E8006DCCA9 /* main.m */; };
19 | B59715F01B32B6E8006DCCA9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B59715EF1B32B6E8006DCCA9 /* AppDelegate.m */; };
20 | B59715F61B32B6E8006DCCA9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B59715F41B32B6E8006DCCA9 /* Main.storyboard */; };
21 | B59715F81B32B6E8006DCCA9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B59715F71B32B6E8006DCCA9 /* Images.xcassets */; };
22 | B59715FB1B32B6E8006DCCA9 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = B59715F91B32B6E8006DCCA9 /* LaunchScreen.xib */; };
23 | B59716071B32B6E8006DCCA9 /* ContactsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = B59716061B32B6E8006DCCA9 /* ContactsTests.m */; };
24 | B59716191B32BA50006DCCA9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B59716181B32BA50006DCCA9 /* Foundation.framework */; };
25 | B597161B1B32BA58006DCCA9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B597161A1B32BA58006DCCA9 /* UIKit.framework */; };
26 | B597161D1B32BA68006DCCA9 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B597161C1B32BA68006DCCA9 /* CoreGraphics.framework */; };
27 | B5A3BD3E1B42CDDE0007E604 /* AddressBookViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD041B42CDDE0007E604 /* AddressBookViewController.m */; };
28 | B5A3BD3F1B42CDDE0007E604 /* AddressBookViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B5A3BD051B42CDDE0007E604 /* AddressBookViewController.xib */; };
29 | B5A3BD401B42CDDE0007E604 /* NSString+TKUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD081B42CDDE0007E604 /* NSString+TKUtilities.m */; };
30 | B5A3BD411B42CDDE0007E604 /* UIImage+TKUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD0A1B42CDDE0007E604 /* UIImage+TKUtilities.m */; };
31 | B5A3BD421B42CDDE0007E604 /* AddContactsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD0D1B42CDDE0007E604 /* AddContactsViewController.m */; };
32 | B5A3BD431B42CDDE0007E604 /* AddContactsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = B5A3BD0E1B42CDDE0007E604 /* AddContactsViewController.xib */; };
33 | B5A3BD441B42CDDE0007E604 /* RecomendsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD101B42CDDE0007E604 /* RecomendsCell.m */; };
34 | B5A3BD451B42CDDE0007E604 /* RecomendsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = B5A3BD111B42CDDE0007E604 /* RecomendsCell.xib */; };
35 | B5A3BD461B42CDDE0007E604 /* ContactDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD141B42CDDE0007E604 /* ContactDetailCell.m */; };
36 | B5A3BD471B42CDDE0007E604 /* ContactDetailSection.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD161B42CDDE0007E604 /* ContactDetailSection.m */; };
37 | B5A3BD481B42CDDE0007E604 /* ContactDetailTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD181B42CDDE0007E604 /* ContactDetailTableViewController.m */; };
38 | B5A3BD491B42CDDE0007E604 /* ContactDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD1A1B42CDDE0007E604 /* ContactDetailViewController.m */; };
39 | B5A3BD4A1B42CDDE0007E604 /* ContactHeadCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD1C1B42CDDE0007E604 /* ContactHeadCell.m */; };
40 | B5A3BD4B1B42CDDE0007E604 /* ContactPersonInfoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD1E1B42CDDE0007E604 /* ContactPersonInfoCell.m */; };
41 | B5A3BD4C1B42CDDE0007E604 /* ContactSchoolInfoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD201B42CDDE0007E604 /* ContactSchoolInfoCell.m */; };
42 | B5A3BD4D1B42CDDE0007E604 /* ContactCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD231B42CDDE0007E604 /* ContactCell.m */; };
43 | B5A3BD4E1B42CDDE0007E604 /* ContactCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = B5A3BD241B42CDDE0007E604 /* ContactCell.xib */; };
44 | B5A3BD4F1B42CDDE0007E604 /* Contacts.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD261B42CDDE0007E604 /* Contacts.m */; };
45 | B5A3BD501B42CDDE0007E604 /* ContactsTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD281B42CDDE0007E604 /* ContactsTableView.m */; };
46 | B5A3BD511B42CDDE0007E604 /* ContactsTableViewIndex.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD2A1B42CDDE0007E604 /* ContactsTableViewIndex.m */; };
47 | B5A3BD521B42CDDE0007E604 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD2C1B42CDDE0007E604 /* ViewController.m */; };
48 | B5A3BD531B42CDDE0007E604 /* ChineseInclude.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD2F1B42CDDE0007E604 /* ChineseInclude.m */; };
49 | B5A3BD541B42CDDE0007E604 /* ChineseToPinyinResource.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD311B42CDDE0007E604 /* ChineseToPinyinResource.m */; };
50 | B5A3BD551B42CDDE0007E604 /* HanyuPinyinOutputFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD331B42CDDE0007E604 /* HanyuPinyinOutputFormat.m */; };
51 | B5A3BD561B42CDDE0007E604 /* NSString+PinYin4Cocoa.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD351B42CDDE0007E604 /* NSString+PinYin4Cocoa.m */; };
52 | B5A3BD571B42CDDE0007E604 /* PinyinFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD371B42CDDE0007E604 /* PinyinFormatter.m */; };
53 | B5A3BD581B42CDDE0007E604 /* PinYinForObjc.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD391B42CDDE0007E604 /* PinYinForObjc.m */; };
54 | B5A3BD591B42CDDE0007E604 /* PinyinHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD3B1B42CDDE0007E604 /* PinyinHelper.m */; };
55 | B5A3BD5A1B42CDDE0007E604 /* unicode_to_hanyu_pinyin.txt in Resources */ = {isa = PBXBuildFile; fileRef = B5A3BD3C1B42CDDE0007E604 /* unicode_to_hanyu_pinyin.txt */; };
56 | B5A3BD5D1B42CE650007E604 /* ABAddressBook.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A3BD5C1B42CE650007E604 /* ABAddressBook.m */; };
57 | /* End PBXBuildFile section */
58 |
59 | /* Begin PBXContainerItemProxy section */
60 | B59716011B32B6E8006DCCA9 /* PBXContainerItemProxy */ = {
61 | isa = PBXContainerItemProxy;
62 | containerPortal = B59715DF1B32B6E8006DCCA9 /* Project object */;
63 | proxyType = 1;
64 | remoteGlobalIDString = B59715E61B32B6E8006DCCA9;
65 | remoteInfo = Contacts;
66 | };
67 | /* End PBXContainerItemProxy section */
68 |
69 | /* Begin PBXFileReference section */
70 | B50357E51B3C2A070068C867 /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; };
71 | B50357E71B3C2A0F0068C867 /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; };
72 | B50357E91B3C2A230068C867 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
73 | B503581F1B3CF9470068C867 /* note_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = note_bg.png; sourceTree = ""; };
74 | B55AA7091B40EB70009E46A1 /* contacts1.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = contacts1.json; sourceTree = ""; };
75 | B56592661B33D6920088EEEE /* touxiang1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = touxiang1.png; sourceTree = ""; };
76 | B56592721B3407830088EEEE /* recomends.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = recomends.json; sourceTree = ""; };
77 | B565927B1B340CFB0088EEEE /* touxiang2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = touxiang2.png; sourceTree = ""; };
78 | B59715E71B32B6E8006DCCA9 /* Contacts.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Contacts.app; sourceTree = BUILT_PRODUCTS_DIR; };
79 | B59715EB1B32B6E8006DCCA9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
80 | B59715EC1B32B6E8006DCCA9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
81 | B59715EE1B32B6E8006DCCA9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
82 | B59715EF1B32B6E8006DCCA9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
83 | B59715F51B32B6E8006DCCA9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
84 | B59715F71B32B6E8006DCCA9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
85 | B59715FA1B32B6E8006DCCA9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
86 | B59716001B32B6E8006DCCA9 /* ContactsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ContactsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
87 | B59716051B32B6E8006DCCA9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
88 | B59716061B32B6E8006DCCA9 /* ContactsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ContactsTests.m; sourceTree = ""; };
89 | B59716181B32BA50006DCCA9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
90 | B597161A1B32BA58006DCCA9 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
91 | B597161C1B32BA68006DCCA9 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
92 | B597164E1B330B1B006DCCA9 /* ContactsPrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactsPrefixHeader.pch; sourceTree = ""; };
93 | B5A3BD031B42CDDE0007E604 /* AddressBookViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddressBookViewController.h; sourceTree = ""; };
94 | B5A3BD041B42CDDE0007E604 /* AddressBookViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddressBookViewController.m; sourceTree = ""; };
95 | B5A3BD051B42CDDE0007E604 /* AddressBookViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AddressBookViewController.xib; sourceTree = ""; };
96 | B5A3BD071B42CDDE0007E604 /* NSString+TKUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+TKUtilities.h"; sourceTree = ""; };
97 | B5A3BD081B42CDDE0007E604 /* NSString+TKUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+TKUtilities.m"; sourceTree = ""; };
98 | B5A3BD091B42CDDE0007E604 /* UIImage+TKUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+TKUtilities.h"; sourceTree = ""; };
99 | B5A3BD0A1B42CDDE0007E604 /* UIImage+TKUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+TKUtilities.m"; sourceTree = ""; };
100 | B5A3BD0C1B42CDDE0007E604 /* AddContactsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddContactsViewController.h; sourceTree = ""; };
101 | B5A3BD0D1B42CDDE0007E604 /* AddContactsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddContactsViewController.m; sourceTree = ""; };
102 | B5A3BD0E1B42CDDE0007E604 /* AddContactsViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AddContactsViewController.xib; sourceTree = ""; };
103 | B5A3BD0F1B42CDDE0007E604 /* RecomendsCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RecomendsCell.h; sourceTree = ""; };
104 | B5A3BD101B42CDDE0007E604 /* RecomendsCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RecomendsCell.m; sourceTree = ""; };
105 | B5A3BD111B42CDDE0007E604 /* RecomendsCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = RecomendsCell.xib; sourceTree = ""; };
106 | B5A3BD131B42CDDE0007E604 /* ContactDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailCell.h; sourceTree = ""; };
107 | B5A3BD141B42CDDE0007E604 /* ContactDetailCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailCell.m; sourceTree = ""; };
108 | B5A3BD151B42CDDE0007E604 /* ContactDetailSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailSection.h; sourceTree = ""; };
109 | B5A3BD161B42CDDE0007E604 /* ContactDetailSection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailSection.m; sourceTree = ""; };
110 | B5A3BD171B42CDDE0007E604 /* ContactDetailTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailTableViewController.h; sourceTree = ""; };
111 | B5A3BD181B42CDDE0007E604 /* ContactDetailTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailTableViewController.m; sourceTree = ""; };
112 | B5A3BD191B42CDDE0007E604 /* ContactDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactDetailViewController.h; sourceTree = ""; };
113 | B5A3BD1A1B42CDDE0007E604 /* ContactDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactDetailViewController.m; sourceTree = ""; };
114 | B5A3BD1B1B42CDDE0007E604 /* ContactHeadCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactHeadCell.h; sourceTree = ""; };
115 | B5A3BD1C1B42CDDE0007E604 /* ContactHeadCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactHeadCell.m; sourceTree = ""; };
116 | B5A3BD1D1B42CDDE0007E604 /* ContactPersonInfoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactPersonInfoCell.h; sourceTree = ""; };
117 | B5A3BD1E1B42CDDE0007E604 /* ContactPersonInfoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactPersonInfoCell.m; sourceTree = ""; };
118 | B5A3BD1F1B42CDDE0007E604 /* ContactSchoolInfoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactSchoolInfoCell.h; sourceTree = ""; };
119 | B5A3BD201B42CDDE0007E604 /* ContactSchoolInfoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactSchoolInfoCell.m; sourceTree = ""; };
120 | B5A3BD221B42CDDE0007E604 /* ContactCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactCell.h; sourceTree = ""; };
121 | B5A3BD231B42CDDE0007E604 /* ContactCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactCell.m; sourceTree = ""; };
122 | B5A3BD241B42CDDE0007E604 /* ContactCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ContactCell.xib; sourceTree = ""; };
123 | B5A3BD251B42CDDE0007E604 /* Contacts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Contacts.h; sourceTree = ""; };
124 | B5A3BD261B42CDDE0007E604 /* Contacts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Contacts.m; sourceTree = ""; };
125 | B5A3BD271B42CDDE0007E604 /* ContactsTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactsTableView.h; sourceTree = ""; };
126 | B5A3BD281B42CDDE0007E604 /* ContactsTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactsTableView.m; sourceTree = ""; };
127 | B5A3BD291B42CDDE0007E604 /* ContactsTableViewIndex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContactsTableViewIndex.h; sourceTree = ""; };
128 | B5A3BD2A1B42CDDE0007E604 /* ContactsTableViewIndex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContactsTableViewIndex.m; sourceTree = ""; };
129 | B5A3BD2B1B42CDDE0007E604 /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; };
130 | B5A3BD2C1B42CDDE0007E604 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; };
131 | B5A3BD2E1B42CDDE0007E604 /* ChineseInclude.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChineseInclude.h; sourceTree = ""; };
132 | B5A3BD2F1B42CDDE0007E604 /* ChineseInclude.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChineseInclude.m; sourceTree = ""; };
133 | B5A3BD301B42CDDE0007E604 /* ChineseToPinyinResource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChineseToPinyinResource.h; sourceTree = ""; };
134 | B5A3BD311B42CDDE0007E604 /* ChineseToPinyinResource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChineseToPinyinResource.m; sourceTree = ""; };
135 | B5A3BD321B42CDDE0007E604 /* HanyuPinyinOutputFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HanyuPinyinOutputFormat.h; sourceTree = ""; };
136 | B5A3BD331B42CDDE0007E604 /* HanyuPinyinOutputFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HanyuPinyinOutputFormat.m; sourceTree = ""; };
137 | B5A3BD341B42CDDE0007E604 /* NSString+PinYin4Cocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+PinYin4Cocoa.h"; sourceTree = ""; };
138 | B5A3BD351B42CDDE0007E604 /* NSString+PinYin4Cocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+PinYin4Cocoa.m"; sourceTree = ""; };
139 | B5A3BD361B42CDDE0007E604 /* PinyinFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PinyinFormatter.h; sourceTree = ""; };
140 | B5A3BD371B42CDDE0007E604 /* PinyinFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PinyinFormatter.m; sourceTree = ""; };
141 | B5A3BD381B42CDDE0007E604 /* PinYinForObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PinYinForObjc.h; sourceTree = ""; };
142 | B5A3BD391B42CDDE0007E604 /* PinYinForObjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PinYinForObjc.m; sourceTree = ""; };
143 | B5A3BD3A1B42CDDE0007E604 /* PinyinHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PinyinHelper.h; sourceTree = ""; };
144 | B5A3BD3B1B42CDDE0007E604 /* PinyinHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PinyinHelper.m; sourceTree = ""; };
145 | B5A3BD3C1B42CDDE0007E604 /* unicode_to_hanyu_pinyin.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = unicode_to_hanyu_pinyin.txt; sourceTree = ""; };
146 | B5A3BD5B1B42CE650007E604 /* ABAddressBook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ABAddressBook.h; sourceTree = ""; };
147 | B5A3BD5C1B42CE650007E604 /* ABAddressBook.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ABAddressBook.m; sourceTree = ""; };
148 | /* End PBXFileReference section */
149 |
150 | /* Begin PBXFrameworksBuildPhase section */
151 | B59715E41B32B6E8006DCCA9 /* Frameworks */ = {
152 | isa = PBXFrameworksBuildPhase;
153 | buildActionMask = 2147483647;
154 | files = (
155 | B50357EA1B3C2A230068C867 /* QuartzCore.framework in Frameworks */,
156 | B50357E81B3C2A0F0068C867 /* AddressBookUI.framework in Frameworks */,
157 | B50357E61B3C2A070068C867 /* AddressBook.framework in Frameworks */,
158 | B597161D1B32BA68006DCCA9 /* CoreGraphics.framework in Frameworks */,
159 | B597161B1B32BA58006DCCA9 /* UIKit.framework in Frameworks */,
160 | B59716191B32BA50006DCCA9 /* Foundation.framework in Frameworks */,
161 | );
162 | runOnlyForDeploymentPostprocessing = 0;
163 | };
164 | B59715FD1B32B6E8006DCCA9 /* Frameworks */ = {
165 | isa = PBXFrameworksBuildPhase;
166 | buildActionMask = 2147483647;
167 | files = (
168 | );
169 | runOnlyForDeploymentPostprocessing = 0;
170 | };
171 | /* End PBXFrameworksBuildPhase section */
172 |
173 | /* Begin PBXGroup section */
174 | B56592641B33D6920088EEEE /* Resources */ = {
175 | isa = PBXGroup;
176 | children = (
177 | B55AA7091B40EB70009E46A1 /* contacts1.json */,
178 | B56592721B3407830088EEEE /* recomends.json */,
179 | B56592661B33D6920088EEEE /* touxiang1.png */,
180 | B565927B1B340CFB0088EEEE /* touxiang2.png */,
181 | B503581F1B3CF9470068C867 /* note_bg.png */,
182 | );
183 | path = Resources;
184 | sourceTree = "";
185 | };
186 | B59715DE1B32B6E8006DCCA9 = {
187 | isa = PBXGroup;
188 | children = (
189 | B59715E91B32B6E8006DCCA9 /* Contacts */,
190 | B59716171B32BA14006DCCA9 /* Frameworks */,
191 | B59716031B32B6E8006DCCA9 /* ContactsTests */,
192 | B59715E81B32B6E8006DCCA9 /* Products */,
193 | );
194 | sourceTree = "";
195 | };
196 | B59715E81B32B6E8006DCCA9 /* Products */ = {
197 | isa = PBXGroup;
198 | children = (
199 | B59715E71B32B6E8006DCCA9 /* Contacts.app */,
200 | B59716001B32B6E8006DCCA9 /* ContactsTests.xctest */,
201 | );
202 | name = Products;
203 | sourceTree = "";
204 | };
205 | B59715E91B32B6E8006DCCA9 /* Contacts */ = {
206 | isa = PBXGroup;
207 | children = (
208 | B59715EE1B32B6E8006DCCA9 /* AppDelegate.h */,
209 | B59715EF1B32B6E8006DCCA9 /* AppDelegate.m */,
210 | B59715F41B32B6E8006DCCA9 /* Main.storyboard */,
211 | B59715F91B32B6E8006DCCA9 /* LaunchScreen.xib */,
212 | B5A3BCFF1B42CDDE0007E604 /* Classes */,
213 | B59715F71B32B6E8006DCCA9 /* Images.xcassets */,
214 | B59715EA1B32B6E8006DCCA9 /* Supporting Files */,
215 | );
216 | path = Contacts;
217 | sourceTree = "";
218 | };
219 | B59715EA1B32B6E8006DCCA9 /* Supporting Files */ = {
220 | isa = PBXGroup;
221 | children = (
222 | B56592641B33D6920088EEEE /* Resources */,
223 | B59715EB1B32B6E8006DCCA9 /* Info.plist */,
224 | B59715EC1B32B6E8006DCCA9 /* main.m */,
225 | );
226 | name = "Supporting Files";
227 | sourceTree = "";
228 | };
229 | B59716031B32B6E8006DCCA9 /* ContactsTests */ = {
230 | isa = PBXGroup;
231 | children = (
232 | B59716061B32B6E8006DCCA9 /* ContactsTests.m */,
233 | B597164E1B330B1B006DCCA9 /* ContactsPrefixHeader.pch */,
234 | B59716041B32B6E8006DCCA9 /* Supporting Files */,
235 | );
236 | path = ContactsTests;
237 | sourceTree = "";
238 | };
239 | B59716041B32B6E8006DCCA9 /* Supporting Files */ = {
240 | isa = PBXGroup;
241 | children = (
242 | B59716051B32B6E8006DCCA9 /* Info.plist */,
243 | );
244 | name = "Supporting Files";
245 | sourceTree = "";
246 | };
247 | B59716171B32BA14006DCCA9 /* Frameworks */ = {
248 | isa = PBXGroup;
249 | children = (
250 | B50357E91B3C2A230068C867 /* QuartzCore.framework */,
251 | B50357E71B3C2A0F0068C867 /* AddressBookUI.framework */,
252 | B50357E51B3C2A070068C867 /* AddressBook.framework */,
253 | B597161C1B32BA68006DCCA9 /* CoreGraphics.framework */,
254 | B597161A1B32BA58006DCCA9 /* UIKit.framework */,
255 | B59716181B32BA50006DCCA9 /* Foundation.framework */,
256 | );
257 | name = Frameworks;
258 | sourceTree = "";
259 | };
260 | B5A3BCFF1B42CDDE0007E604 /* Classes */ = {
261 | isa = PBXGroup;
262 | children = (
263 | B5A3BD2D1B42CDDE0007E604 /* PinYin */,
264 | B5A3BD001B42CDDE0007E604 /* ABContacts */,
265 | B5A3BD211B42CDDE0007E604 /* ContactsView */,
266 | B5A3BD0B1B42CDDE0007E604 /* AddContact */,
267 | B5A3BD121B42CDDE0007E604 /* ContactDetail */,
268 | );
269 | path = Classes;
270 | sourceTree = "";
271 | };
272 | B5A3BD001B42CDDE0007E604 /* ABContacts */ = {
273 | isa = PBXGroup;
274 | children = (
275 | B5A3BD061B42CDDE0007E604 /* Base */,
276 | B5A3BD031B42CDDE0007E604 /* AddressBookViewController.h */,
277 | B5A3BD041B42CDDE0007E604 /* AddressBookViewController.m */,
278 | B5A3BD051B42CDDE0007E604 /* AddressBookViewController.xib */,
279 | B5A3BD5B1B42CE650007E604 /* ABAddressBook.h */,
280 | B5A3BD5C1B42CE650007E604 /* ABAddressBook.m */,
281 | );
282 | path = ABContacts;
283 | sourceTree = "";
284 | };
285 | B5A3BD061B42CDDE0007E604 /* Base */ = {
286 | isa = PBXGroup;
287 | children = (
288 | B5A3BD071B42CDDE0007E604 /* NSString+TKUtilities.h */,
289 | B5A3BD081B42CDDE0007E604 /* NSString+TKUtilities.m */,
290 | B5A3BD091B42CDDE0007E604 /* UIImage+TKUtilities.h */,
291 | B5A3BD0A1B42CDDE0007E604 /* UIImage+TKUtilities.m */,
292 | );
293 | path = Base;
294 | sourceTree = "";
295 | };
296 | B5A3BD0B1B42CDDE0007E604 /* AddContact */ = {
297 | isa = PBXGroup;
298 | children = (
299 | B5A3BD0C1B42CDDE0007E604 /* AddContactsViewController.h */,
300 | B5A3BD0D1B42CDDE0007E604 /* AddContactsViewController.m */,
301 | B5A3BD0E1B42CDDE0007E604 /* AddContactsViewController.xib */,
302 | B5A3BD0F1B42CDDE0007E604 /* RecomendsCell.h */,
303 | B5A3BD101B42CDDE0007E604 /* RecomendsCell.m */,
304 | B5A3BD111B42CDDE0007E604 /* RecomendsCell.xib */,
305 | );
306 | path = AddContact;
307 | sourceTree = "";
308 | };
309 | B5A3BD121B42CDDE0007E604 /* ContactDetail */ = {
310 | isa = PBXGroup;
311 | children = (
312 | B5A3BD131B42CDDE0007E604 /* ContactDetailCell.h */,
313 | B5A3BD141B42CDDE0007E604 /* ContactDetailCell.m */,
314 | B5A3BD151B42CDDE0007E604 /* ContactDetailSection.h */,
315 | B5A3BD161B42CDDE0007E604 /* ContactDetailSection.m */,
316 | B5A3BD171B42CDDE0007E604 /* ContactDetailTableViewController.h */,
317 | B5A3BD181B42CDDE0007E604 /* ContactDetailTableViewController.m */,
318 | B5A3BD191B42CDDE0007E604 /* ContactDetailViewController.h */,
319 | B5A3BD1A1B42CDDE0007E604 /* ContactDetailViewController.m */,
320 | B5A3BD1B1B42CDDE0007E604 /* ContactHeadCell.h */,
321 | B5A3BD1C1B42CDDE0007E604 /* ContactHeadCell.m */,
322 | B5A3BD1D1B42CDDE0007E604 /* ContactPersonInfoCell.h */,
323 | B5A3BD1E1B42CDDE0007E604 /* ContactPersonInfoCell.m */,
324 | B5A3BD1F1B42CDDE0007E604 /* ContactSchoolInfoCell.h */,
325 | B5A3BD201B42CDDE0007E604 /* ContactSchoolInfoCell.m */,
326 | );
327 | path = ContactDetail;
328 | sourceTree = "";
329 | };
330 | B5A3BD211B42CDDE0007E604 /* ContactsView */ = {
331 | isa = PBXGroup;
332 | children = (
333 | B5A3BD221B42CDDE0007E604 /* ContactCell.h */,
334 | B5A3BD231B42CDDE0007E604 /* ContactCell.m */,
335 | B5A3BD241B42CDDE0007E604 /* ContactCell.xib */,
336 | B5A3BD251B42CDDE0007E604 /* Contacts.h */,
337 | B5A3BD261B42CDDE0007E604 /* Contacts.m */,
338 | B5A3BD271B42CDDE0007E604 /* ContactsTableView.h */,
339 | B5A3BD281B42CDDE0007E604 /* ContactsTableView.m */,
340 | B5A3BD291B42CDDE0007E604 /* ContactsTableViewIndex.h */,
341 | B5A3BD2A1B42CDDE0007E604 /* ContactsTableViewIndex.m */,
342 | B5A3BD2B1B42CDDE0007E604 /* ViewController.h */,
343 | B5A3BD2C1B42CDDE0007E604 /* ViewController.m */,
344 | );
345 | path = ContactsView;
346 | sourceTree = "";
347 | };
348 | B5A3BD2D1B42CDDE0007E604 /* PinYin */ = {
349 | isa = PBXGroup;
350 | children = (
351 | B5A3BD2E1B42CDDE0007E604 /* ChineseInclude.h */,
352 | B5A3BD2F1B42CDDE0007E604 /* ChineseInclude.m */,
353 | B5A3BD301B42CDDE0007E604 /* ChineseToPinyinResource.h */,
354 | B5A3BD311B42CDDE0007E604 /* ChineseToPinyinResource.m */,
355 | B5A3BD321B42CDDE0007E604 /* HanyuPinyinOutputFormat.h */,
356 | B5A3BD331B42CDDE0007E604 /* HanyuPinyinOutputFormat.m */,
357 | B5A3BD341B42CDDE0007E604 /* NSString+PinYin4Cocoa.h */,
358 | B5A3BD351B42CDDE0007E604 /* NSString+PinYin4Cocoa.m */,
359 | B5A3BD361B42CDDE0007E604 /* PinyinFormatter.h */,
360 | B5A3BD371B42CDDE0007E604 /* PinyinFormatter.m */,
361 | B5A3BD381B42CDDE0007E604 /* PinYinForObjc.h */,
362 | B5A3BD391B42CDDE0007E604 /* PinYinForObjc.m */,
363 | B5A3BD3A1B42CDDE0007E604 /* PinyinHelper.h */,
364 | B5A3BD3B1B42CDDE0007E604 /* PinyinHelper.m */,
365 | B5A3BD3C1B42CDDE0007E604 /* unicode_to_hanyu_pinyin.txt */,
366 | );
367 | path = PinYin;
368 | sourceTree = "";
369 | };
370 | /* End PBXGroup section */
371 |
372 | /* Begin PBXNativeTarget section */
373 | B59715E61B32B6E8006DCCA9 /* Contacts */ = {
374 | isa = PBXNativeTarget;
375 | buildConfigurationList = B597160A1B32B6E8006DCCA9 /* Build configuration list for PBXNativeTarget "Contacts" */;
376 | buildPhases = (
377 | B59715E31B32B6E8006DCCA9 /* Sources */,
378 | B59715E41B32B6E8006DCCA9 /* Frameworks */,
379 | B59715E51B32B6E8006DCCA9 /* Resources */,
380 | );
381 | buildRules = (
382 | );
383 | dependencies = (
384 | );
385 | name = Contacts;
386 | productName = Contacts;
387 | productReference = B59715E71B32B6E8006DCCA9 /* Contacts.app */;
388 | productType = "com.apple.product-type.application";
389 | };
390 | B59715FF1B32B6E8006DCCA9 /* ContactsTests */ = {
391 | isa = PBXNativeTarget;
392 | buildConfigurationList = B597160D1B32B6E8006DCCA9 /* Build configuration list for PBXNativeTarget "ContactsTests" */;
393 | buildPhases = (
394 | B59715FC1B32B6E8006DCCA9 /* Sources */,
395 | B59715FD1B32B6E8006DCCA9 /* Frameworks */,
396 | B59715FE1B32B6E8006DCCA9 /* Resources */,
397 | );
398 | buildRules = (
399 | );
400 | dependencies = (
401 | B59716021B32B6E8006DCCA9 /* PBXTargetDependency */,
402 | );
403 | name = ContactsTests;
404 | productName = ContactsTests;
405 | productReference = B59716001B32B6E8006DCCA9 /* ContactsTests.xctest */;
406 | productType = "com.apple.product-type.bundle.unit-test";
407 | };
408 | /* End PBXNativeTarget section */
409 |
410 | /* Begin PBXProject section */
411 | B59715DF1B32B6E8006DCCA9 /* Project object */ = {
412 | isa = PBXProject;
413 | attributes = {
414 | LastUpgradeCheck = 0630;
415 | ORGANIZATIONNAME = Emma;
416 | TargetAttributes = {
417 | B59715E61B32B6E8006DCCA9 = {
418 | CreatedOnToolsVersion = 6.3;
419 | };
420 | B59715FF1B32B6E8006DCCA9 = {
421 | CreatedOnToolsVersion = 6.3;
422 | TestTargetID = B59715E61B32B6E8006DCCA9;
423 | };
424 | };
425 | };
426 | buildConfigurationList = B59715E21B32B6E8006DCCA9 /* Build configuration list for PBXProject "Contacts" */;
427 | compatibilityVersion = "Xcode 3.2";
428 | developmentRegion = English;
429 | hasScannedForEncodings = 0;
430 | knownRegions = (
431 | en,
432 | Base,
433 | );
434 | mainGroup = B59715DE1B32B6E8006DCCA9;
435 | productRefGroup = B59715E81B32B6E8006DCCA9 /* Products */;
436 | projectDirPath = "";
437 | projectRoot = "";
438 | targets = (
439 | B59715E61B32B6E8006DCCA9 /* Contacts */,
440 | B59715FF1B32B6E8006DCCA9 /* ContactsTests */,
441 | );
442 | };
443 | /* End PBXProject section */
444 |
445 | /* Begin PBXResourcesBuildPhase section */
446 | B59715E51B32B6E8006DCCA9 /* Resources */ = {
447 | isa = PBXResourcesBuildPhase;
448 | buildActionMask = 2147483647;
449 | files = (
450 | B5A3BD3F1B42CDDE0007E604 /* AddressBookViewController.xib in Resources */,
451 | B50358201B3CF9470068C867 /* note_bg.png in Resources */,
452 | B5A3BD451B42CDDE0007E604 /* RecomendsCell.xib in Resources */,
453 | B55AA70A1B40EB70009E46A1 /* contacts1.json in Resources */,
454 | B5A3BD431B42CDDE0007E604 /* AddContactsViewController.xib in Resources */,
455 | B56592731B3407830088EEEE /* recomends.json in Resources */,
456 | B565927C1B340CFB0088EEEE /* touxiang2.png in Resources */,
457 | B59715F61B32B6E8006DCCA9 /* Main.storyboard in Resources */,
458 | B5A3BD5A1B42CDDE0007E604 /* unicode_to_hanyu_pinyin.txt in Resources */,
459 | B5A3BD4E1B42CDDE0007E604 /* ContactCell.xib in Resources */,
460 | B59715FB1B32B6E8006DCCA9 /* LaunchScreen.xib in Resources */,
461 | B56592681B33D6920088EEEE /* touxiang1.png in Resources */,
462 | B59715F81B32B6E8006DCCA9 /* Images.xcassets in Resources */,
463 | );
464 | runOnlyForDeploymentPostprocessing = 0;
465 | };
466 | B59715FE1B32B6E8006DCCA9 /* Resources */ = {
467 | isa = PBXResourcesBuildPhase;
468 | buildActionMask = 2147483647;
469 | files = (
470 | );
471 | runOnlyForDeploymentPostprocessing = 0;
472 | };
473 | /* End PBXResourcesBuildPhase section */
474 |
475 | /* Begin PBXSourcesBuildPhase section */
476 | B59715E31B32B6E8006DCCA9 /* Sources */ = {
477 | isa = PBXSourcesBuildPhase;
478 | buildActionMask = 2147483647;
479 | files = (
480 | B5A3BD591B42CDDE0007E604 /* PinyinHelper.m in Sources */,
481 | B5A3BD581B42CDDE0007E604 /* PinYinForObjc.m in Sources */,
482 | B59715F01B32B6E8006DCCA9 /* AppDelegate.m in Sources */,
483 | B5A3BD441B42CDDE0007E604 /* RecomendsCell.m in Sources */,
484 | B5A3BD511B42CDDE0007E604 /* ContactsTableViewIndex.m in Sources */,
485 | B5A3BD4A1B42CDDE0007E604 /* ContactHeadCell.m in Sources */,
486 | B5A3BD571B42CDDE0007E604 /* PinyinFormatter.m in Sources */,
487 | B5A3BD4D1B42CDDE0007E604 /* ContactCell.m in Sources */,
488 | B5A3BD531B42CDDE0007E604 /* ChineseInclude.m in Sources */,
489 | B5A3BD541B42CDDE0007E604 /* ChineseToPinyinResource.m in Sources */,
490 | B5A3BD471B42CDDE0007E604 /* ContactDetailSection.m in Sources */,
491 | B5A3BD3E1B42CDDE0007E604 /* AddressBookViewController.m in Sources */,
492 | B5A3BD401B42CDDE0007E604 /* NSString+TKUtilities.m in Sources */,
493 | B5A3BD491B42CDDE0007E604 /* ContactDetailViewController.m in Sources */,
494 | B5A3BD421B42CDDE0007E604 /* AddContactsViewController.m in Sources */,
495 | B59715ED1B32B6E8006DCCA9 /* main.m in Sources */,
496 | B5A3BD5D1B42CE650007E604 /* ABAddressBook.m in Sources */,
497 | B5A3BD481B42CDDE0007E604 /* ContactDetailTableViewController.m in Sources */,
498 | B5A3BD551B42CDDE0007E604 /* HanyuPinyinOutputFormat.m in Sources */,
499 | B5A3BD4F1B42CDDE0007E604 /* Contacts.m in Sources */,
500 | B5A3BD521B42CDDE0007E604 /* ViewController.m in Sources */,
501 | B5A3BD4C1B42CDDE0007E604 /* ContactSchoolInfoCell.m in Sources */,
502 | B5A3BD501B42CDDE0007E604 /* ContactsTableView.m in Sources */,
503 | B5A3BD4B1B42CDDE0007E604 /* ContactPersonInfoCell.m in Sources */,
504 | B5A3BD561B42CDDE0007E604 /* NSString+PinYin4Cocoa.m in Sources */,
505 | B5A3BD461B42CDDE0007E604 /* ContactDetailCell.m in Sources */,
506 | B5A3BD411B42CDDE0007E604 /* UIImage+TKUtilities.m in Sources */,
507 | );
508 | runOnlyForDeploymentPostprocessing = 0;
509 | };
510 | B59715FC1B32B6E8006DCCA9 /* Sources */ = {
511 | isa = PBXSourcesBuildPhase;
512 | buildActionMask = 2147483647;
513 | files = (
514 | B59716071B32B6E8006DCCA9 /* ContactsTests.m in Sources */,
515 | );
516 | runOnlyForDeploymentPostprocessing = 0;
517 | };
518 | /* End PBXSourcesBuildPhase section */
519 |
520 | /* Begin PBXTargetDependency section */
521 | B59716021B32B6E8006DCCA9 /* PBXTargetDependency */ = {
522 | isa = PBXTargetDependency;
523 | target = B59715E61B32B6E8006DCCA9 /* Contacts */;
524 | targetProxy = B59716011B32B6E8006DCCA9 /* PBXContainerItemProxy */;
525 | };
526 | /* End PBXTargetDependency section */
527 |
528 | /* Begin PBXVariantGroup section */
529 | B59715F41B32B6E8006DCCA9 /* Main.storyboard */ = {
530 | isa = PBXVariantGroup;
531 | children = (
532 | B59715F51B32B6E8006DCCA9 /* Base */,
533 | );
534 | name = Main.storyboard;
535 | sourceTree = "";
536 | };
537 | B59715F91B32B6E8006DCCA9 /* LaunchScreen.xib */ = {
538 | isa = PBXVariantGroup;
539 | children = (
540 | B59715FA1B32B6E8006DCCA9 /* Base */,
541 | );
542 | name = LaunchScreen.xib;
543 | sourceTree = "";
544 | };
545 | /* End PBXVariantGroup section */
546 |
547 | /* Begin XCBuildConfiguration section */
548 | B59716081B32B6E8006DCCA9 /* Debug */ = {
549 | isa = XCBuildConfiguration;
550 | buildSettings = {
551 | ALWAYS_SEARCH_USER_PATHS = NO;
552 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
553 | CLANG_CXX_LIBRARY = "libc++";
554 | CLANG_ENABLE_MODULES = YES;
555 | CLANG_ENABLE_OBJC_ARC = YES;
556 | CLANG_WARN_BOOL_CONVERSION = YES;
557 | CLANG_WARN_CONSTANT_CONVERSION = YES;
558 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
559 | CLANG_WARN_EMPTY_BODY = YES;
560 | CLANG_WARN_ENUM_CONVERSION = YES;
561 | CLANG_WARN_INT_CONVERSION = YES;
562 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
563 | CLANG_WARN_UNREACHABLE_CODE = YES;
564 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
565 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
566 | COPY_PHASE_STRIP = NO;
567 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
568 | ENABLE_STRICT_OBJC_MSGSEND = YES;
569 | GCC_C_LANGUAGE_STANDARD = gnu99;
570 | GCC_DYNAMIC_NO_PIC = NO;
571 | GCC_NO_COMMON_BLOCKS = YES;
572 | GCC_OPTIMIZATION_LEVEL = 0;
573 | GCC_PREPROCESSOR_DEFINITIONS = (
574 | "DEBUG=1",
575 | "$(inherited)",
576 | );
577 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
578 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
579 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
580 | GCC_WARN_UNDECLARED_SELECTOR = YES;
581 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
582 | GCC_WARN_UNUSED_FUNCTION = YES;
583 | GCC_WARN_UNUSED_VARIABLE = YES;
584 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
585 | MTL_ENABLE_DEBUG_INFO = YES;
586 | ONLY_ACTIVE_ARCH = YES;
587 | SDKROOT = iphoneos;
588 | };
589 | name = Debug;
590 | };
591 | B59716091B32B6E8006DCCA9 /* Release */ = {
592 | isa = XCBuildConfiguration;
593 | buildSettings = {
594 | ALWAYS_SEARCH_USER_PATHS = NO;
595 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
596 | CLANG_CXX_LIBRARY = "libc++";
597 | CLANG_ENABLE_MODULES = YES;
598 | CLANG_ENABLE_OBJC_ARC = YES;
599 | CLANG_WARN_BOOL_CONVERSION = YES;
600 | CLANG_WARN_CONSTANT_CONVERSION = YES;
601 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
602 | CLANG_WARN_EMPTY_BODY = YES;
603 | CLANG_WARN_ENUM_CONVERSION = YES;
604 | CLANG_WARN_INT_CONVERSION = YES;
605 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
606 | CLANG_WARN_UNREACHABLE_CODE = YES;
607 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
608 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
609 | COPY_PHASE_STRIP = NO;
610 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
611 | ENABLE_NS_ASSERTIONS = NO;
612 | ENABLE_STRICT_OBJC_MSGSEND = YES;
613 | GCC_C_LANGUAGE_STANDARD = gnu99;
614 | GCC_NO_COMMON_BLOCKS = YES;
615 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
616 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
617 | GCC_WARN_UNDECLARED_SELECTOR = YES;
618 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
619 | GCC_WARN_UNUSED_FUNCTION = YES;
620 | GCC_WARN_UNUSED_VARIABLE = YES;
621 | IPHONEOS_DEPLOYMENT_TARGET = 8.3;
622 | MTL_ENABLE_DEBUG_INFO = NO;
623 | SDKROOT = iphoneos;
624 | VALIDATE_PRODUCT = YES;
625 | };
626 | name = Release;
627 | };
628 | B597160B1B32B6E8006DCCA9 /* Debug */ = {
629 | isa = XCBuildConfiguration;
630 | buildSettings = {
631 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
632 | INFOPLIST_FILE = Contacts/Info.plist;
633 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
634 | PRODUCT_NAME = "$(TARGET_NAME)";
635 | };
636 | name = Debug;
637 | };
638 | B597160C1B32B6E8006DCCA9 /* Release */ = {
639 | isa = XCBuildConfiguration;
640 | buildSettings = {
641 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
642 | INFOPLIST_FILE = Contacts/Info.plist;
643 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
644 | PRODUCT_NAME = "$(TARGET_NAME)";
645 | };
646 | name = Release;
647 | };
648 | B597160E1B32B6E8006DCCA9 /* Debug */ = {
649 | isa = XCBuildConfiguration;
650 | buildSettings = {
651 | BUNDLE_LOADER = "$(TEST_HOST)";
652 | FRAMEWORK_SEARCH_PATHS = (
653 | "$(SDKROOT)/Developer/Library/Frameworks",
654 | "$(inherited)",
655 | );
656 | GCC_PREPROCESSOR_DEFINITIONS = (
657 | "DEBUG=1",
658 | "$(inherited)",
659 | );
660 | INFOPLIST_FILE = ContactsTests/Info.plist;
661 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
662 | PRODUCT_NAME = "$(TARGET_NAME)";
663 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Contacts.app/Contacts";
664 | };
665 | name = Debug;
666 | };
667 | B597160F1B32B6E8006DCCA9 /* Release */ = {
668 | isa = XCBuildConfiguration;
669 | buildSettings = {
670 | BUNDLE_LOADER = "$(TEST_HOST)";
671 | FRAMEWORK_SEARCH_PATHS = (
672 | "$(SDKROOT)/Developer/Library/Frameworks",
673 | "$(inherited)",
674 | );
675 | INFOPLIST_FILE = ContactsTests/Info.plist;
676 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
677 | PRODUCT_NAME = "$(TARGET_NAME)";
678 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Contacts.app/Contacts";
679 | };
680 | name = Release;
681 | };
682 | /* End XCBuildConfiguration section */
683 |
684 | /* Begin XCConfigurationList section */
685 | B59715E21B32B6E8006DCCA9 /* Build configuration list for PBXProject "Contacts" */ = {
686 | isa = XCConfigurationList;
687 | buildConfigurations = (
688 | B59716081B32B6E8006DCCA9 /* Debug */,
689 | B59716091B32B6E8006DCCA9 /* Release */,
690 | );
691 | defaultConfigurationIsVisible = 0;
692 | defaultConfigurationName = Release;
693 | };
694 | B597160A1B32B6E8006DCCA9 /* Build configuration list for PBXNativeTarget "Contacts" */ = {
695 | isa = XCConfigurationList;
696 | buildConfigurations = (
697 | B597160B1B32B6E8006DCCA9 /* Debug */,
698 | B597160C1B32B6E8006DCCA9 /* Release */,
699 | );
700 | defaultConfigurationIsVisible = 0;
701 | defaultConfigurationName = Release;
702 | };
703 | B597160D1B32B6E8006DCCA9 /* Build configuration list for PBXNativeTarget "ContactsTests" */ = {
704 | isa = XCConfigurationList;
705 | buildConfigurations = (
706 | B597160E1B32B6E8006DCCA9 /* Debug */,
707 | B597160F1B32B6E8006DCCA9 /* Release */,
708 | );
709 | defaultConfigurationIsVisible = 0;
710 | defaultConfigurationName = Release;
711 | };
712 | /* End XCConfigurationList section */
713 | };
714 | rootObject = B59715DF1B32B6E8006DCCA9 /* Project object */;
715 | }
716 |
--------------------------------------------------------------------------------