├── BAContact.podspec ├── BAContact.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── 1piao.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── boai.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── 1piao.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ ├── BAContact.xcscheme │ │ └── xcschememanagement.plist │ └── boai.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── BAContact.xcscheme │ └── xcschememanagement.plist ├── BAContact ├── AppDelegate.h ├── AppDelegate.m ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── BAAlertController │ ├── BAAlertController.h │ ├── BAKit_ConfigurationDefine.h │ ├── NSMutableAttributedString+BAKit.h │ ├── NSMutableAttributedString+BAKit.m │ ├── NSObject+BARunTime.h │ ├── NSObject+BARunTime.m │ ├── UIAlertController+BAKit.h │ └── UIAlertController+BAKit.m ├── BAContact │ ├── BAContact.h │ ├── BAKit_ConfigurationDefine.h │ ├── BAKit_LocalizedIndexedCollation.h │ ├── BAKit_LocalizedIndexedCollation.m │ ├── UIImage+BAContact.h │ └── UIImage+BAContact.m ├── BAContactsModel.h ├── BAContactsModel.m ├── Info.plist ├── Launch Screen.storyboard ├── Resource │ └── Images │ │ ├── Cell_icons │ │ ├── 0.jpg │ │ ├── 1.jpg │ │ ├── 10.jpg │ │ ├── 11.jpg │ │ ├── 12.jpg │ │ ├── 13.jpg │ │ ├── 14.jpg │ │ ├── 15.jpg │ │ ├── 16.jpg │ │ ├── 17.jpg │ │ ├── 18.jpg │ │ ├── 19.jpg │ │ ├── 2.jpg │ │ ├── 20.jpg │ │ ├── 21.jpg │ │ ├── 22.jpg │ │ ├── 23.jpg │ │ ├── 3.jpg │ │ ├── 4.jpg │ │ ├── 5.jpg │ │ ├── 6.jpg │ │ ├── 7.jpg │ │ ├── 8.jpg │ │ └── 9.jpg │ │ ├── Contacts │ │ ├── Contact_icon_ContactTag.imageset │ │ │ ├── Contact_icon_ContactTag@2x.png │ │ │ └── Contact_icon_ContactTag@3x.png │ │ ├── add_friend_icon_addgroup.imageset │ │ │ ├── add_friend_icon_addgroup@2x.png │ │ │ └── add_friend_icon_addgroup@3x.png │ │ ├── add_friend_icon_offical.imageset │ │ │ ├── add_friend_icon_offical@2x.png │ │ │ └── add_friend_icon_offical@3x.png │ │ ├── barbuttonicon_more.imageset │ │ │ ├── barbuttonicon_more.png │ │ │ ├── barbuttonicon_more@2x.png │ │ │ └── barbuttonicon_more@3x.png │ │ ├── contacts_add_friend.imageset │ │ │ ├── contacts_add_friend@2x.png │ │ │ └── contacts_add_friend@3x.png │ │ └── plugins_FriendNotify.imageset │ │ │ ├── plugins_FriendNotify@2x.png │ │ │ └── plugins_FriendNotify@3x.png │ │ └── UserImages │ │ ├── icon0.jpg │ │ ├── icon1.jpg │ │ ├── icon2.jpg │ │ ├── icon3.jpg │ │ ├── icon4.jpg │ │ ├── pbg.jpg │ │ ├── pic0.jpg │ │ ├── pic1.jpg │ │ ├── pic2.jpg │ │ ├── pic3.jpg │ │ ├── pic4.jpg │ │ ├── pic5.jpg │ │ ├── pic6.jpg │ │ ├── pic7.jpg │ │ ├── pic8.jpg │ │ └── picon.jpg ├── ViewController.h ├── ViewController.m ├── ViewController2.h ├── ViewController2.m └── main.m ├── Images ├── BAContact.png ├── BAContact1.png ├── BAContact2.png └── BAContact3.png ├── LICENSE └── README.md /BAContact.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'BAContact' 3 | s.version = '1.0.0' 4 | s.summary = '通讯录,最简单的中英文混合排序封装,微信通讯录 demo!' 5 | s.homepage = 'https://github.com/BAHome/BAContact' 6 | s.license = 'MIT' 7 | s.authors = { 'boai' => 'sunboyan@outlook.com' } 8 | s.platform = :ios, '8.0' 9 | s.source = { :git => 'https://github.com/BAHome/BAContact.git', :tag => s.version.to_s } 10 | s.source_files = 'BAContact/BAContact/*.{h,m}' 11 | s.requires_arc = true 12 | end 13 | -------------------------------------------------------------------------------- /BAContact.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C42E88421F32FC1800C0F084 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E88411F32FC1800C0F084 /* AppDelegate.m */; }; 11 | C42E88451F32FC1800C0F084 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E88441F32FC1800C0F084 /* ViewController.m */; }; 12 | C42E884A1F32FC1800C0F084 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C42E88491F32FC1800C0F084 /* Assets.xcassets */; }; 13 | C42E88501F32FC1800C0F084 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E884F1F32FC1800C0F084 /* main.m */; }; 14 | C42E88601F32FDAC00C0F084 /* BAContactsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E885E1F32FDAC00C0F084 /* BAContactsModel.m */; }; 15 | C42E88641F32FF5000C0F084 /* UIImage+BAContact.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E88631F32FF5000C0F084 /* UIImage+BAContact.m */; }; 16 | C42E886F1F33026100C0F084 /* BAKit_LocalizedIndexedCollation.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E885B1F32FCFA00C0F084 /* BAKit_LocalizedIndexedCollation.m */; }; 17 | C46F75FD1F346BC500163E11 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C46F75FC1F346BC500163E11 /* Launch Screen.storyboard */; }; 18 | C4E511D91F3322A500C0635C /* 0.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88FE1F33059E00C0F084 /* 0.jpg */; }; 19 | C4E511DA1F3322A500C0635C /* 1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88FF1F33059E00C0F084 /* 1.jpg */; }; 20 | C4E511DB1F3322A500C0635C /* 10.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89001F33059E00C0F084 /* 10.jpg */; }; 21 | C4E511DC1F3322A500C0635C /* 11.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89011F33059E00C0F084 /* 11.jpg */; }; 22 | C4E511DD1F3322A500C0635C /* 12.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89021F33059E00C0F084 /* 12.jpg */; }; 23 | C4E511DE1F3322A500C0635C /* 13.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89031F33059E00C0F084 /* 13.jpg */; }; 24 | C4E511DF1F3322A500C0635C /* 14.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89041F33059E00C0F084 /* 14.jpg */; }; 25 | C4E511E01F3322A500C0635C /* 15.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89051F33059E00C0F084 /* 15.jpg */; }; 26 | C4E511E11F3322A500C0635C /* 16.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89061F33059E00C0F084 /* 16.jpg */; }; 27 | C4E511E21F3322A500C0635C /* 17.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89071F33059E00C0F084 /* 17.jpg */; }; 28 | C4E511E31F3322A500C0635C /* 18.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89081F33059E00C0F084 /* 18.jpg */; }; 29 | C4E511E41F3322A500C0635C /* 19.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89091F33059E00C0F084 /* 19.jpg */; }; 30 | C4E511E51F3322A500C0635C /* 2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E890A1F33059E00C0F084 /* 2.jpg */; }; 31 | C4E511E61F3322A500C0635C /* 20.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E890B1F33059E00C0F084 /* 20.jpg */; }; 32 | C4E511E71F3322A500C0635C /* 21.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E890C1F33059E00C0F084 /* 21.jpg */; }; 33 | C4E511E81F3322A500C0635C /* 22.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E890D1F33059E00C0F084 /* 22.jpg */; }; 34 | C4E511E91F3322A500C0635C /* 23.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E890E1F33059E00C0F084 /* 23.jpg */; }; 35 | C4E511EA1F3322A500C0635C /* 3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E890F1F33059E00C0F084 /* 3.jpg */; }; 36 | C4E511EB1F3322A500C0635C /* 4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89101F33059E00C0F084 /* 4.jpg */; }; 37 | C4E511EC1F3322A500C0635C /* 5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89111F33059E00C0F084 /* 5.jpg */; }; 38 | C4E511ED1F3322A500C0635C /* 6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89121F33059E00C0F084 /* 6.jpg */; }; 39 | C4E511EE1F3322A500C0635C /* 7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89131F33059E00C0F084 /* 7.jpg */; }; 40 | C4E511EF1F3322A500C0635C /* 8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89141F33059E00C0F084 /* 8.jpg */; }; 41 | C4E511F01F3322A500C0635C /* 9.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E89151F33059E00C0F084 /* 9.jpg */; }; 42 | C4E511F11F3322C000C0635C /* add_friend_icon_addgroup@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88E21F33055800C0F084 /* add_friend_icon_addgroup@2x.png */; }; 43 | C4E511F21F3322C500C0635C /* add_friend_icon_addgroup@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88E31F33055800C0F084 /* add_friend_icon_addgroup@3x.png */; }; 44 | C4E511F31F3322D200C0635C /* add_friend_icon_offical@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88E61F33055800C0F084 /* add_friend_icon_offical@2x.png */; }; 45 | C4E511F41F3322D200C0635C /* add_friend_icon_offical@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88E71F33055800C0F084 /* add_friend_icon_offical@3x.png */; }; 46 | C4E511F51F3322DA00C0635C /* barbuttonicon_more.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88EA1F33055800C0F084 /* barbuttonicon_more.png */; }; 47 | C4E511F61F3322DA00C0635C /* barbuttonicon_more@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88EB1F33055800C0F084 /* barbuttonicon_more@2x.png */; }; 48 | C4E511F71F3322DA00C0635C /* barbuttonicon_more@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88EC1F33055800C0F084 /* barbuttonicon_more@3x.png */; }; 49 | C4E511F81F3322E100C0635C /* Contact_icon_ContactTag@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88F11F33055800C0F084 /* Contact_icon_ContactTag@2x.png */; }; 50 | C4E511F91F3322E100C0635C /* Contact_icon_ContactTag@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88F21F33055800C0F084 /* Contact_icon_ContactTag@3x.png */; }; 51 | C4E511FA1F3322E600C0635C /* contacts_add_friend@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88F51F33055800C0F084 /* contacts_add_friend@2x.png */; }; 52 | C4E511FB1F3322E600C0635C /* contacts_add_friend@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88F61F33055800C0F084 /* contacts_add_friend@3x.png */; }; 53 | C4E511FC1F3322EB00C0635C /* plugins_FriendNotify@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88FB1F33055800C0F084 /* plugins_FriendNotify@2x.png */; }; 54 | C4E511FD1F3322EB00C0635C /* plugins_FriendNotify@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = C42E88FC1F33055800C0F084 /* plugins_FriendNotify@3x.png */; }; 55 | C4E511FE1F3322F200C0635C /* icon0.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D01F33052E00C0F084 /* icon0.jpg */; }; 56 | C4E511FF1F3322F200C0635C /* icon1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D11F33052E00C0F084 /* icon1.jpg */; }; 57 | C4E512001F3322F200C0635C /* icon2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D21F33052E00C0F084 /* icon2.jpg */; }; 58 | C4E512011F3322F200C0635C /* icon3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D31F33052E00C0F084 /* icon3.jpg */; }; 59 | C4E512021F3322F200C0635C /* icon4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D41F33052E00C0F084 /* icon4.jpg */; }; 60 | C4E512031F3322F200C0635C /* pbg.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D51F33052E00C0F084 /* pbg.jpg */; }; 61 | C4E512041F3322F200C0635C /* pic0.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D61F33052E00C0F084 /* pic0.jpg */; }; 62 | C4E512051F3322F200C0635C /* pic1.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D71F33052E00C0F084 /* pic1.jpg */; }; 63 | C4E512061F3322F200C0635C /* pic2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D81F33052E00C0F084 /* pic2.jpg */; }; 64 | C4E512071F3322F200C0635C /* pic3.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88D91F33052E00C0F084 /* pic3.jpg */; }; 65 | C4E512081F3322F200C0635C /* pic4.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88DA1F33052E00C0F084 /* pic4.jpg */; }; 66 | C4E512091F3322F200C0635C /* pic5.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88DB1F33052E00C0F084 /* pic5.jpg */; }; 67 | C4E5120A1F3322F200C0635C /* pic6.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88DC1F33052E00C0F084 /* pic6.jpg */; }; 68 | C4E5120B1F3322F200C0635C /* pic7.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88DD1F33052E00C0F084 /* pic7.jpg */; }; 69 | C4E5120C1F3322F200C0635C /* pic8.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88DE1F33052E00C0F084 /* pic8.jpg */; }; 70 | C4E5120D1F3322F200C0635C /* picon.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C42E88DF1F33052E00C0F084 /* picon.jpg */; }; 71 | C4E512101F33FD2800C0635C /* NSMutableAttributedString+BAKit.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E88691F3300DF00C0F084 /* NSMutableAttributedString+BAKit.m */; }; 72 | C4E512111F33FD2C00C0635C /* NSObject+BARunTime.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E886B1F3300DF00C0F084 /* NSObject+BARunTime.m */; }; 73 | C4E512121F33FD3000C0635C /* UIAlertController+BAKit.m in Sources */ = {isa = PBXBuildFile; fileRef = C42E886D1F3300DF00C0F084 /* UIAlertController+BAKit.m */; }; 74 | C4E512151F34132100C0635C /* ViewController2.m in Sources */ = {isa = PBXBuildFile; fileRef = C4E512141F34132100C0635C /* ViewController2.m */; }; 75 | /* End PBXBuildFile section */ 76 | 77 | /* Begin PBXFileReference section */ 78 | C42E883D1F32FC1800C0F084 /* BAContact.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BAContact.app; sourceTree = BUILT_PRODUCTS_DIR; }; 79 | C42E88401F32FC1800C0F084 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 80 | C42E88411F32FC1800C0F084 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 81 | C42E88431F32FC1800C0F084 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 82 | C42E88441F32FC1800C0F084 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 83 | C42E88491F32FC1800C0F084 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 84 | C42E884E1F32FC1800C0F084 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 85 | C42E884F1F32FC1800C0F084 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 86 | C42E885B1F32FCFA00C0F084 /* BAKit_LocalizedIndexedCollation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BAKit_LocalizedIndexedCollation.m; sourceTree = ""; }; 87 | C42E885C1F32FCFA00C0F084 /* BAKit_LocalizedIndexedCollation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAKit_LocalizedIndexedCollation.h; sourceTree = ""; }; 88 | C42E885D1F32FD0E00C0F084 /* BAContact.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAContact.h; sourceTree = ""; }; 89 | C42E885E1F32FDAC00C0F084 /* BAContactsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BAContactsModel.m; sourceTree = ""; }; 90 | C42E885F1F32FDAC00C0F084 /* BAContactsModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAContactsModel.h; sourceTree = ""; }; 91 | C42E88611F32FE0800C0F084 /* BAKit_ConfigurationDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAKit_ConfigurationDefine.h; sourceTree = ""; }; 92 | C42E88621F32FF5000C0F084 /* UIImage+BAContact.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIImage+BAContact.h"; sourceTree = ""; }; 93 | C42E88631F32FF5000C0F084 /* UIImage+BAContact.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIImage+BAContact.m"; sourceTree = ""; }; 94 | C42E88661F3300DF00C0F084 /* BAAlertController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAAlertController.h; sourceTree = ""; }; 95 | C42E88671F3300DF00C0F084 /* BAKit_ConfigurationDefine.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BAKit_ConfigurationDefine.h; sourceTree = ""; }; 96 | C42E88681F3300DF00C0F084 /* NSMutableAttributedString+BAKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableAttributedString+BAKit.h"; sourceTree = ""; }; 97 | C42E88691F3300DF00C0F084 /* NSMutableAttributedString+BAKit.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableAttributedString+BAKit.m"; sourceTree = ""; }; 98 | C42E886A1F3300DF00C0F084 /* NSObject+BARunTime.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+BARunTime.h"; sourceTree = ""; }; 99 | C42E886B1F3300DF00C0F084 /* NSObject+BARunTime.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+BARunTime.m"; sourceTree = ""; }; 100 | C42E886C1F3300DF00C0F084 /* UIAlertController+BAKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIAlertController+BAKit.h"; sourceTree = ""; }; 101 | C42E886D1F3300DF00C0F084 /* UIAlertController+BAKit.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIAlertController+BAKit.m"; sourceTree = ""; }; 102 | C42E88D01F33052E00C0F084 /* icon0.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = icon0.jpg; sourceTree = ""; }; 103 | C42E88D11F33052E00C0F084 /* icon1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = icon1.jpg; sourceTree = ""; }; 104 | C42E88D21F33052E00C0F084 /* icon2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = icon2.jpg; sourceTree = ""; }; 105 | C42E88D31F33052E00C0F084 /* icon3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = icon3.jpg; sourceTree = ""; }; 106 | C42E88D41F33052E00C0F084 /* icon4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = icon4.jpg; sourceTree = ""; }; 107 | C42E88D51F33052E00C0F084 /* pbg.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pbg.jpg; sourceTree = ""; }; 108 | C42E88D61F33052E00C0F084 /* pic0.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic0.jpg; sourceTree = ""; }; 109 | C42E88D71F33052E00C0F084 /* pic1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic1.jpg; sourceTree = ""; }; 110 | C42E88D81F33052E00C0F084 /* pic2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic2.jpg; sourceTree = ""; }; 111 | C42E88D91F33052E00C0F084 /* pic3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic3.jpg; sourceTree = ""; }; 112 | C42E88DA1F33052E00C0F084 /* pic4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic4.jpg; sourceTree = ""; }; 113 | C42E88DB1F33052E00C0F084 /* pic5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic5.jpg; sourceTree = ""; }; 114 | C42E88DC1F33052E00C0F084 /* pic6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic6.jpg; sourceTree = ""; }; 115 | C42E88DD1F33052E00C0F084 /* pic7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic7.jpg; sourceTree = ""; }; 116 | C42E88DE1F33052E00C0F084 /* pic8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = pic8.jpg; sourceTree = ""; }; 117 | C42E88DF1F33052E00C0F084 /* picon.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = picon.jpg; sourceTree = ""; }; 118 | C42E88E21F33055800C0F084 /* add_friend_icon_addgroup@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "add_friend_icon_addgroup@2x.png"; sourceTree = ""; }; 119 | C42E88E31F33055800C0F084 /* add_friend_icon_addgroup@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "add_friend_icon_addgroup@3x.png"; sourceTree = ""; }; 120 | C42E88E61F33055800C0F084 /* add_friend_icon_offical@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "add_friend_icon_offical@2x.png"; sourceTree = ""; }; 121 | C42E88E71F33055800C0F084 /* add_friend_icon_offical@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "add_friend_icon_offical@3x.png"; sourceTree = ""; }; 122 | C42E88EA1F33055800C0F084 /* barbuttonicon_more.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = barbuttonicon_more.png; sourceTree = ""; }; 123 | C42E88EB1F33055800C0F084 /* barbuttonicon_more@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "barbuttonicon_more@2x.png"; sourceTree = ""; }; 124 | C42E88EC1F33055800C0F084 /* barbuttonicon_more@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "barbuttonicon_more@3x.png"; sourceTree = ""; }; 125 | C42E88F11F33055800C0F084 /* Contact_icon_ContactTag@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Contact_icon_ContactTag@2x.png"; sourceTree = ""; }; 126 | C42E88F21F33055800C0F084 /* Contact_icon_ContactTag@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Contact_icon_ContactTag@3x.png"; sourceTree = ""; }; 127 | C42E88F51F33055800C0F084 /* contacts_add_friend@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "contacts_add_friend@2x.png"; sourceTree = ""; }; 128 | C42E88F61F33055800C0F084 /* contacts_add_friend@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "contacts_add_friend@3x.png"; sourceTree = ""; }; 129 | C42E88FB1F33055800C0F084 /* plugins_FriendNotify@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "plugins_FriendNotify@2x.png"; sourceTree = ""; }; 130 | C42E88FC1F33055800C0F084 /* plugins_FriendNotify@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "plugins_FriendNotify@3x.png"; sourceTree = ""; }; 131 | C42E88FE1F33059E00C0F084 /* 0.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 0.jpg; sourceTree = ""; }; 132 | C42E88FF1F33059E00C0F084 /* 1.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 1.jpg; sourceTree = ""; }; 133 | C42E89001F33059E00C0F084 /* 10.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 10.jpg; sourceTree = ""; }; 134 | C42E89011F33059E00C0F084 /* 11.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 11.jpg; sourceTree = ""; }; 135 | C42E89021F33059E00C0F084 /* 12.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 12.jpg; sourceTree = ""; }; 136 | C42E89031F33059E00C0F084 /* 13.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 13.jpg; sourceTree = ""; }; 137 | C42E89041F33059E00C0F084 /* 14.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 14.jpg; sourceTree = ""; }; 138 | C42E89051F33059E00C0F084 /* 15.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 15.jpg; sourceTree = ""; }; 139 | C42E89061F33059E00C0F084 /* 16.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 16.jpg; sourceTree = ""; }; 140 | C42E89071F33059E00C0F084 /* 17.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 17.jpg; sourceTree = ""; }; 141 | C42E89081F33059E00C0F084 /* 18.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 18.jpg; sourceTree = ""; }; 142 | C42E89091F33059E00C0F084 /* 19.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 19.jpg; sourceTree = ""; }; 143 | C42E890A1F33059E00C0F084 /* 2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 2.jpg; sourceTree = ""; }; 144 | C42E890B1F33059E00C0F084 /* 20.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 20.jpg; sourceTree = ""; }; 145 | C42E890C1F33059E00C0F084 /* 21.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 21.jpg; sourceTree = ""; }; 146 | C42E890D1F33059E00C0F084 /* 22.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 22.jpg; sourceTree = ""; }; 147 | C42E890E1F33059E00C0F084 /* 23.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 23.jpg; sourceTree = ""; }; 148 | C42E890F1F33059E00C0F084 /* 3.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 3.jpg; sourceTree = ""; }; 149 | C42E89101F33059E00C0F084 /* 4.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 4.jpg; sourceTree = ""; }; 150 | C42E89111F33059E00C0F084 /* 5.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 5.jpg; sourceTree = ""; }; 151 | C42E89121F33059E00C0F084 /* 6.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 6.jpg; sourceTree = ""; }; 152 | C42E89131F33059E00C0F084 /* 7.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 7.jpg; sourceTree = ""; }; 153 | C42E89141F33059E00C0F084 /* 8.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 8.jpg; sourceTree = ""; }; 154 | C42E89151F33059E00C0F084 /* 9.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = 9.jpg; sourceTree = ""; }; 155 | C46F75FC1F346BC500163E11 /* Launch Screen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = ""; }; 156 | C4E512131F34132100C0635C /* ViewController2.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController2.h; sourceTree = ""; }; 157 | C4E512141F34132100C0635C /* ViewController2.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController2.m; sourceTree = ""; }; 158 | /* End PBXFileReference section */ 159 | 160 | /* Begin PBXFrameworksBuildPhase section */ 161 | C42E883A1F32FC1800C0F084 /* Frameworks */ = { 162 | isa = PBXFrameworksBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | ); 166 | runOnlyForDeploymentPostprocessing = 0; 167 | }; 168 | /* End PBXFrameworksBuildPhase section */ 169 | 170 | /* Begin PBXGroup section */ 171 | C42E88341F32FC1800C0F084 = { 172 | isa = PBXGroup; 173 | children = ( 174 | C42E883F1F32FC1800C0F084 /* BAContact */, 175 | C42E883E1F32FC1800C0F084 /* Products */, 176 | ); 177 | sourceTree = ""; 178 | }; 179 | C42E883E1F32FC1800C0F084 /* Products */ = { 180 | isa = PBXGroup; 181 | children = ( 182 | C42E883D1F32FC1800C0F084 /* BAContact.app */, 183 | ); 184 | name = Products; 185 | sourceTree = ""; 186 | }; 187 | C42E883F1F32FC1800C0F084 /* BAContact */ = { 188 | isa = PBXGroup; 189 | children = ( 190 | C42E88561F32FCBD00C0F084 /* BAContact */, 191 | C42E88401F32FC1800C0F084 /* AppDelegate.h */, 192 | C42E88411F32FC1800C0F084 /* AppDelegate.m */, 193 | C42E88431F32FC1800C0F084 /* ViewController.h */, 194 | C42E88441F32FC1800C0F084 /* ViewController.m */, 195 | C42E885F1F32FDAC00C0F084 /* BAContactsModel.h */, 196 | C42E885E1F32FDAC00C0F084 /* BAContactsModel.m */, 197 | C4E512131F34132100C0635C /* ViewController2.h */, 198 | C4E512141F34132100C0635C /* ViewController2.m */, 199 | C42E88701F33052E00C0F084 /* Resource */, 200 | C42E88651F3300DF00C0F084 /* BAAlertController */, 201 | C42E88491F32FC1800C0F084 /* Assets.xcassets */, 202 | C42E884E1F32FC1800C0F084 /* Info.plist */, 203 | C42E884F1F32FC1800C0F084 /* main.m */, 204 | C46F75FC1F346BC500163E11 /* Launch Screen.storyboard */, 205 | ); 206 | path = BAContact; 207 | sourceTree = ""; 208 | }; 209 | C42E88561F32FCBD00C0F084 /* BAContact */ = { 210 | isa = PBXGroup; 211 | children = ( 212 | C42E885D1F32FD0E00C0F084 /* BAContact.h */, 213 | C42E88611F32FE0800C0F084 /* BAKit_ConfigurationDefine.h */, 214 | C42E885C1F32FCFA00C0F084 /* BAKit_LocalizedIndexedCollation.h */, 215 | C42E885B1F32FCFA00C0F084 /* BAKit_LocalizedIndexedCollation.m */, 216 | C42E88621F32FF5000C0F084 /* UIImage+BAContact.h */, 217 | C42E88631F32FF5000C0F084 /* UIImage+BAContact.m */, 218 | ); 219 | path = BAContact; 220 | sourceTree = ""; 221 | }; 222 | C42E88651F3300DF00C0F084 /* BAAlertController */ = { 223 | isa = PBXGroup; 224 | children = ( 225 | C42E88661F3300DF00C0F084 /* BAAlertController.h */, 226 | C42E88671F3300DF00C0F084 /* BAKit_ConfigurationDefine.h */, 227 | C42E88681F3300DF00C0F084 /* NSMutableAttributedString+BAKit.h */, 228 | C42E88691F3300DF00C0F084 /* NSMutableAttributedString+BAKit.m */, 229 | C42E886A1F3300DF00C0F084 /* NSObject+BARunTime.h */, 230 | C42E886B1F3300DF00C0F084 /* NSObject+BARunTime.m */, 231 | C42E886C1F3300DF00C0F084 /* UIAlertController+BAKit.h */, 232 | C42E886D1F3300DF00C0F084 /* UIAlertController+BAKit.m */, 233 | ); 234 | path = BAAlertController; 235 | sourceTree = ""; 236 | }; 237 | C42E88701F33052E00C0F084 /* Resource */ = { 238 | isa = PBXGroup; 239 | children = ( 240 | C42E88761F33052E00C0F084 /* Images */, 241 | ); 242 | path = Resource; 243 | sourceTree = ""; 244 | }; 245 | C42E88761F33052E00C0F084 /* Images */ = { 246 | isa = PBXGroup; 247 | children = ( 248 | C42E88FD1F33059E00C0F084 /* Cell_icons */, 249 | C42E88E01F33055800C0F084 /* Contacts */, 250 | C42E88CF1F33052E00C0F084 /* UserImages */, 251 | ); 252 | path = Images; 253 | sourceTree = ""; 254 | }; 255 | C42E88CF1F33052E00C0F084 /* UserImages */ = { 256 | isa = PBXGroup; 257 | children = ( 258 | C42E88D01F33052E00C0F084 /* icon0.jpg */, 259 | C42E88D11F33052E00C0F084 /* icon1.jpg */, 260 | C42E88D21F33052E00C0F084 /* icon2.jpg */, 261 | C42E88D31F33052E00C0F084 /* icon3.jpg */, 262 | C42E88D41F33052E00C0F084 /* icon4.jpg */, 263 | C42E88D51F33052E00C0F084 /* pbg.jpg */, 264 | C42E88D61F33052E00C0F084 /* pic0.jpg */, 265 | C42E88D71F33052E00C0F084 /* pic1.jpg */, 266 | C42E88D81F33052E00C0F084 /* pic2.jpg */, 267 | C42E88D91F33052E00C0F084 /* pic3.jpg */, 268 | C42E88DA1F33052E00C0F084 /* pic4.jpg */, 269 | C42E88DB1F33052E00C0F084 /* pic5.jpg */, 270 | C42E88DC1F33052E00C0F084 /* pic6.jpg */, 271 | C42E88DD1F33052E00C0F084 /* pic7.jpg */, 272 | C42E88DE1F33052E00C0F084 /* pic8.jpg */, 273 | C42E88DF1F33052E00C0F084 /* picon.jpg */, 274 | ); 275 | path = UserImages; 276 | sourceTree = ""; 277 | }; 278 | C42E88E01F33055800C0F084 /* Contacts */ = { 279 | isa = PBXGroup; 280 | children = ( 281 | C42E88E11F33055800C0F084 /* add_friend_icon_addgroup.imageset */, 282 | C42E88E51F33055800C0F084 /* add_friend_icon_offical.imageset */, 283 | C42E88E91F33055800C0F084 /* barbuttonicon_more.imageset */, 284 | C42E88EE1F33055800C0F084 /* Brand Assets.launchimage */, 285 | C42E88F01F33055800C0F084 /* Contact_icon_ContactTag.imageset */, 286 | C42E88F41F33055800C0F084 /* contacts_add_friend.imageset */, 287 | C42E88F91F33055800C0F084 /* plugins_FriendNotify.imageset */, 288 | ); 289 | path = Contacts; 290 | sourceTree = ""; 291 | }; 292 | C42E88E11F33055800C0F084 /* add_friend_icon_addgroup.imageset */ = { 293 | isa = PBXGroup; 294 | children = ( 295 | C42E88E21F33055800C0F084 /* add_friend_icon_addgroup@2x.png */, 296 | C42E88E31F33055800C0F084 /* add_friend_icon_addgroup@3x.png */, 297 | ); 298 | path = add_friend_icon_addgroup.imageset; 299 | sourceTree = ""; 300 | }; 301 | C42E88E51F33055800C0F084 /* add_friend_icon_offical.imageset */ = { 302 | isa = PBXGroup; 303 | children = ( 304 | C42E88E61F33055800C0F084 /* add_friend_icon_offical@2x.png */, 305 | C42E88E71F33055800C0F084 /* add_friend_icon_offical@3x.png */, 306 | ); 307 | path = add_friend_icon_offical.imageset; 308 | sourceTree = ""; 309 | }; 310 | C42E88E91F33055800C0F084 /* barbuttonicon_more.imageset */ = { 311 | isa = PBXGroup; 312 | children = ( 313 | C42E88EA1F33055800C0F084 /* barbuttonicon_more.png */, 314 | C42E88EB1F33055800C0F084 /* barbuttonicon_more@2x.png */, 315 | C42E88EC1F33055800C0F084 /* barbuttonicon_more@3x.png */, 316 | ); 317 | path = barbuttonicon_more.imageset; 318 | sourceTree = ""; 319 | }; 320 | C42E88EE1F33055800C0F084 /* Brand Assets.launchimage */ = { 321 | isa = PBXGroup; 322 | children = ( 323 | ); 324 | path = "Brand Assets.launchimage"; 325 | sourceTree = ""; 326 | }; 327 | C42E88F01F33055800C0F084 /* Contact_icon_ContactTag.imageset */ = { 328 | isa = PBXGroup; 329 | children = ( 330 | C42E88F11F33055800C0F084 /* Contact_icon_ContactTag@2x.png */, 331 | C42E88F21F33055800C0F084 /* Contact_icon_ContactTag@3x.png */, 332 | ); 333 | path = Contact_icon_ContactTag.imageset; 334 | sourceTree = ""; 335 | }; 336 | C42E88F41F33055800C0F084 /* contacts_add_friend.imageset */ = { 337 | isa = PBXGroup; 338 | children = ( 339 | C42E88F51F33055800C0F084 /* contacts_add_friend@2x.png */, 340 | C42E88F61F33055800C0F084 /* contacts_add_friend@3x.png */, 341 | ); 342 | path = contacts_add_friend.imageset; 343 | sourceTree = ""; 344 | }; 345 | C42E88F91F33055800C0F084 /* plugins_FriendNotify.imageset */ = { 346 | isa = PBXGroup; 347 | children = ( 348 | C42E88FB1F33055800C0F084 /* plugins_FriendNotify@2x.png */, 349 | C42E88FC1F33055800C0F084 /* plugins_FriendNotify@3x.png */, 350 | ); 351 | path = plugins_FriendNotify.imageset; 352 | sourceTree = ""; 353 | }; 354 | C42E88FD1F33059E00C0F084 /* Cell_icons */ = { 355 | isa = PBXGroup; 356 | children = ( 357 | C42E88FE1F33059E00C0F084 /* 0.jpg */, 358 | C42E88FF1F33059E00C0F084 /* 1.jpg */, 359 | C42E89001F33059E00C0F084 /* 10.jpg */, 360 | C42E89011F33059E00C0F084 /* 11.jpg */, 361 | C42E89021F33059E00C0F084 /* 12.jpg */, 362 | C42E89031F33059E00C0F084 /* 13.jpg */, 363 | C42E89041F33059E00C0F084 /* 14.jpg */, 364 | C42E89051F33059E00C0F084 /* 15.jpg */, 365 | C42E89061F33059E00C0F084 /* 16.jpg */, 366 | C42E89071F33059E00C0F084 /* 17.jpg */, 367 | C42E89081F33059E00C0F084 /* 18.jpg */, 368 | C42E89091F33059E00C0F084 /* 19.jpg */, 369 | C42E890A1F33059E00C0F084 /* 2.jpg */, 370 | C42E890B1F33059E00C0F084 /* 20.jpg */, 371 | C42E890C1F33059E00C0F084 /* 21.jpg */, 372 | C42E890D1F33059E00C0F084 /* 22.jpg */, 373 | C42E890E1F33059E00C0F084 /* 23.jpg */, 374 | C42E890F1F33059E00C0F084 /* 3.jpg */, 375 | C42E89101F33059E00C0F084 /* 4.jpg */, 376 | C42E89111F33059E00C0F084 /* 5.jpg */, 377 | C42E89121F33059E00C0F084 /* 6.jpg */, 378 | C42E89131F33059E00C0F084 /* 7.jpg */, 379 | C42E89141F33059E00C0F084 /* 8.jpg */, 380 | C42E89151F33059E00C0F084 /* 9.jpg */, 381 | ); 382 | path = Cell_icons; 383 | sourceTree = ""; 384 | }; 385 | /* End PBXGroup section */ 386 | 387 | /* Begin PBXNativeTarget section */ 388 | C42E883C1F32FC1800C0F084 /* BAContact */ = { 389 | isa = PBXNativeTarget; 390 | buildConfigurationList = C42E88531F32FC1800C0F084 /* Build configuration list for PBXNativeTarget "BAContact" */; 391 | buildPhases = ( 392 | C42E88391F32FC1800C0F084 /* Sources */, 393 | C42E883A1F32FC1800C0F084 /* Frameworks */, 394 | C42E883B1F32FC1800C0F084 /* Resources */, 395 | ); 396 | buildRules = ( 397 | ); 398 | dependencies = ( 399 | ); 400 | name = BAContact; 401 | productName = BAContact; 402 | productReference = C42E883D1F32FC1800C0F084 /* BAContact.app */; 403 | productType = "com.apple.product-type.application"; 404 | }; 405 | /* End PBXNativeTarget section */ 406 | 407 | /* Begin PBXProject section */ 408 | C42E88351F32FC1800C0F084 /* Project object */ = { 409 | isa = PBXProject; 410 | attributes = { 411 | LastUpgradeCheck = 0900; 412 | ORGANIZATIONNAME = boai; 413 | TargetAttributes = { 414 | C42E883C1F32FC1800C0F084 = { 415 | CreatedOnToolsVersion = 9.0; 416 | }; 417 | }; 418 | }; 419 | buildConfigurationList = C42E88381F32FC1800C0F084 /* Build configuration list for PBXProject "BAContact" */; 420 | compatibilityVersion = "Xcode 8.0"; 421 | developmentRegion = en; 422 | hasScannedForEncodings = 0; 423 | knownRegions = ( 424 | en, 425 | Base, 426 | ); 427 | mainGroup = C42E88341F32FC1800C0F084; 428 | productRefGroup = C42E883E1F32FC1800C0F084 /* Products */; 429 | projectDirPath = ""; 430 | projectRoot = ""; 431 | targets = ( 432 | C42E883C1F32FC1800C0F084 /* BAContact */, 433 | ); 434 | }; 435 | /* End PBXProject section */ 436 | 437 | /* Begin PBXResourcesBuildPhase section */ 438 | C42E883B1F32FC1800C0F084 /* Resources */ = { 439 | isa = PBXResourcesBuildPhase; 440 | buildActionMask = 2147483647; 441 | files = ( 442 | C4E511E31F3322A500C0635C /* 18.jpg in Resources */, 443 | C4E511F91F3322E100C0635C /* Contact_icon_ContactTag@3x.png in Resources */, 444 | C4E511F11F3322C000C0635C /* add_friend_icon_addgroup@2x.png in Resources */, 445 | C4E511F61F3322DA00C0635C /* barbuttonicon_more@2x.png in Resources */, 446 | C4E511DF1F3322A500C0635C /* 14.jpg in Resources */, 447 | C4E512021F3322F200C0635C /* icon4.jpg in Resources */, 448 | C4E512001F3322F200C0635C /* icon2.jpg in Resources */, 449 | C4E511F31F3322D200C0635C /* add_friend_icon_offical@2x.png in Resources */, 450 | C4E511DB1F3322A500C0635C /* 10.jpg in Resources */, 451 | C4E512031F3322F200C0635C /* pbg.jpg in Resources */, 452 | C4E512091F3322F200C0635C /* pic5.jpg in Resources */, 453 | C4E511EE1F3322A500C0635C /* 7.jpg in Resources */, 454 | C4E511ED1F3322A500C0635C /* 6.jpg in Resources */, 455 | C4E511F21F3322C500C0635C /* add_friend_icon_addgroup@3x.png in Resources */, 456 | C4E512011F3322F200C0635C /* icon3.jpg in Resources */, 457 | C4E512051F3322F200C0635C /* pic1.jpg in Resources */, 458 | C4E511DE1F3322A500C0635C /* 13.jpg in Resources */, 459 | C4E511FF1F3322F200C0635C /* icon1.jpg in Resources */, 460 | C4E511D91F3322A500C0635C /* 0.jpg in Resources */, 461 | C4E511E71F3322A500C0635C /* 21.jpg in Resources */, 462 | C4E511DD1F3322A500C0635C /* 12.jpg in Resources */, 463 | C4E512071F3322F200C0635C /* pic3.jpg in Resources */, 464 | C4E511E01F3322A500C0635C /* 15.jpg in Resources */, 465 | C4E511E61F3322A500C0635C /* 20.jpg in Resources */, 466 | C4E5120D1F3322F200C0635C /* picon.jpg in Resources */, 467 | C4E511DA1F3322A500C0635C /* 1.jpg in Resources */, 468 | C4E511FA1F3322E600C0635C /* contacts_add_friend@2x.png in Resources */, 469 | C4E511E91F3322A500C0635C /* 23.jpg in Resources */, 470 | C46F75FD1F346BC500163E11 /* Launch Screen.storyboard in Resources */, 471 | C4E511FD1F3322EB00C0635C /* plugins_FriendNotify@3x.png in Resources */, 472 | C4E511F01F3322A500C0635C /* 9.jpg in Resources */, 473 | C4E5120B1F3322F200C0635C /* pic7.jpg in Resources */, 474 | C4E5120A1F3322F200C0635C /* pic6.jpg in Resources */, 475 | C4E511F81F3322E100C0635C /* Contact_icon_ContactTag@2x.png in Resources */, 476 | C4E511EC1F3322A500C0635C /* 5.jpg in Resources */, 477 | C4E511E11F3322A500C0635C /* 16.jpg in Resources */, 478 | C4E511F41F3322D200C0635C /* add_friend_icon_offical@3x.png in Resources */, 479 | C4E511FE1F3322F200C0635C /* icon0.jpg in Resources */, 480 | C4E511E41F3322A500C0635C /* 19.jpg in Resources */, 481 | C4E511F71F3322DA00C0635C /* barbuttonicon_more@3x.png in Resources */, 482 | C4E511FC1F3322EB00C0635C /* plugins_FriendNotify@2x.png in Resources */, 483 | C4E511DC1F3322A500C0635C /* 11.jpg in Resources */, 484 | C4E511E21F3322A500C0635C /* 17.jpg in Resources */, 485 | C4E512061F3322F200C0635C /* pic2.jpg in Resources */, 486 | C4E511EB1F3322A500C0635C /* 4.jpg in Resources */, 487 | C4E511EA1F3322A500C0635C /* 3.jpg in Resources */, 488 | C4E512081F3322F200C0635C /* pic4.jpg in Resources */, 489 | C4E511F51F3322DA00C0635C /* barbuttonicon_more.png in Resources */, 490 | C4E511EF1F3322A500C0635C /* 8.jpg in Resources */, 491 | C4E511E51F3322A500C0635C /* 2.jpg in Resources */, 492 | C4E511FB1F3322E600C0635C /* contacts_add_friend@3x.png in Resources */, 493 | C4E5120C1F3322F200C0635C /* pic8.jpg in Resources */, 494 | C4E511E81F3322A500C0635C /* 22.jpg in Resources */, 495 | C42E884A1F32FC1800C0F084 /* Assets.xcassets in Resources */, 496 | C4E512041F3322F200C0635C /* pic0.jpg in Resources */, 497 | ); 498 | runOnlyForDeploymentPostprocessing = 0; 499 | }; 500 | /* End PBXResourcesBuildPhase section */ 501 | 502 | /* Begin PBXSourcesBuildPhase section */ 503 | C42E88391F32FC1800C0F084 /* Sources */ = { 504 | isa = PBXSourcesBuildPhase; 505 | buildActionMask = 2147483647; 506 | files = ( 507 | C42E88451F32FC1800C0F084 /* ViewController.m in Sources */, 508 | C42E88501F32FC1800C0F084 /* main.m in Sources */, 509 | C42E88641F32FF5000C0F084 /* UIImage+BAContact.m in Sources */, 510 | C42E886F1F33026100C0F084 /* BAKit_LocalizedIndexedCollation.m in Sources */, 511 | C42E88421F32FC1800C0F084 /* AppDelegate.m in Sources */, 512 | C42E88601F32FDAC00C0F084 /* BAContactsModel.m in Sources */, 513 | C4E512101F33FD2800C0635C /* NSMutableAttributedString+BAKit.m in Sources */, 514 | C4E512151F34132100C0635C /* ViewController2.m in Sources */, 515 | C4E512111F33FD2C00C0635C /* NSObject+BARunTime.m in Sources */, 516 | C4E512121F33FD3000C0635C /* UIAlertController+BAKit.m in Sources */, 517 | ); 518 | runOnlyForDeploymentPostprocessing = 0; 519 | }; 520 | /* End PBXSourcesBuildPhase section */ 521 | 522 | /* Begin XCBuildConfiguration section */ 523 | C42E88511F32FC1800C0F084 /* Debug */ = { 524 | isa = XCBuildConfiguration; 525 | buildSettings = { 526 | ALWAYS_SEARCH_USER_PATHS = NO; 527 | CLANG_ANALYZER_NONNULL = YES; 528 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 529 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 530 | CLANG_CXX_LIBRARY = "libc++"; 531 | CLANG_ENABLE_MODULES = YES; 532 | CLANG_ENABLE_OBJC_ARC = YES; 533 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 534 | CLANG_WARN_BOOL_CONVERSION = YES; 535 | CLANG_WARN_COMMA = YES; 536 | CLANG_WARN_CONSTANT_CONVERSION = YES; 537 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 538 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 539 | CLANG_WARN_EMPTY_BODY = YES; 540 | CLANG_WARN_ENUM_CONVERSION = YES; 541 | CLANG_WARN_INFINITE_RECURSION = YES; 542 | CLANG_WARN_INT_CONVERSION = YES; 543 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 544 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 545 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 546 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 547 | CLANG_WARN_STRICT_PROTOTYPES = YES; 548 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 549 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 550 | CLANG_WARN_UNREACHABLE_CODE = YES; 551 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 552 | CODE_SIGN_IDENTITY = "iPhone Developer"; 553 | COPY_PHASE_STRIP = NO; 554 | DEBUG_INFORMATION_FORMAT = dwarf; 555 | ENABLE_STRICT_OBJC_MSGSEND = YES; 556 | ENABLE_TESTABILITY = YES; 557 | GCC_C_LANGUAGE_STANDARD = gnu11; 558 | GCC_DYNAMIC_NO_PIC = NO; 559 | GCC_NO_COMMON_BLOCKS = YES; 560 | GCC_OPTIMIZATION_LEVEL = 0; 561 | GCC_PREPROCESSOR_DEFINITIONS = ( 562 | "DEBUG=1", 563 | "$(inherited)", 564 | ); 565 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 566 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 567 | GCC_WARN_UNDECLARED_SELECTOR = YES; 568 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 569 | GCC_WARN_UNUSED_FUNCTION = YES; 570 | GCC_WARN_UNUSED_VARIABLE = YES; 571 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 572 | MTL_ENABLE_DEBUG_INFO = YES; 573 | ONLY_ACTIVE_ARCH = YES; 574 | SDKROOT = iphoneos; 575 | }; 576 | name = Debug; 577 | }; 578 | C42E88521F32FC1800C0F084 /* Release */ = { 579 | isa = XCBuildConfiguration; 580 | buildSettings = { 581 | ALWAYS_SEARCH_USER_PATHS = NO; 582 | CLANG_ANALYZER_NONNULL = YES; 583 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 584 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 585 | CLANG_CXX_LIBRARY = "libc++"; 586 | CLANG_ENABLE_MODULES = YES; 587 | CLANG_ENABLE_OBJC_ARC = YES; 588 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 589 | CLANG_WARN_BOOL_CONVERSION = YES; 590 | CLANG_WARN_COMMA = YES; 591 | CLANG_WARN_CONSTANT_CONVERSION = YES; 592 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 593 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 594 | CLANG_WARN_EMPTY_BODY = YES; 595 | CLANG_WARN_ENUM_CONVERSION = YES; 596 | CLANG_WARN_INFINITE_RECURSION = YES; 597 | CLANG_WARN_INT_CONVERSION = YES; 598 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 599 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 600 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 601 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 602 | CLANG_WARN_STRICT_PROTOTYPES = YES; 603 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 604 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 605 | CLANG_WARN_UNREACHABLE_CODE = YES; 606 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 607 | CODE_SIGN_IDENTITY = "iPhone Developer"; 608 | COPY_PHASE_STRIP = NO; 609 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 610 | ENABLE_NS_ASSERTIONS = NO; 611 | ENABLE_STRICT_OBJC_MSGSEND = YES; 612 | GCC_C_LANGUAGE_STANDARD = gnu11; 613 | GCC_NO_COMMON_BLOCKS = YES; 614 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 615 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 616 | GCC_WARN_UNDECLARED_SELECTOR = YES; 617 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 618 | GCC_WARN_UNUSED_FUNCTION = YES; 619 | GCC_WARN_UNUSED_VARIABLE = YES; 620 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 621 | MTL_ENABLE_DEBUG_INFO = NO; 622 | SDKROOT = iphoneos; 623 | VALIDATE_PRODUCT = YES; 624 | }; 625 | name = Release; 626 | }; 627 | C42E88541F32FC1800C0F084 /* Debug */ = { 628 | isa = XCBuildConfiguration; 629 | buildSettings = { 630 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 631 | DEVELOPMENT_TEAM = JB3QR65942; 632 | INFOPLIST_FILE = BAContact/Info.plist; 633 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 634 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 635 | PRODUCT_BUNDLE_IDENTIFIER = com.boaihome.BAContact; 636 | PRODUCT_NAME = "$(TARGET_NAME)"; 637 | TARGETED_DEVICE_FAMILY = 1; 638 | }; 639 | name = Debug; 640 | }; 641 | C42E88551F32FC1800C0F084 /* Release */ = { 642 | isa = XCBuildConfiguration; 643 | buildSettings = { 644 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 645 | DEVELOPMENT_TEAM = JB3QR65942; 646 | INFOPLIST_FILE = BAContact/Info.plist; 647 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 648 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 649 | PRODUCT_BUNDLE_IDENTIFIER = com.boaihome.BAContact; 650 | PRODUCT_NAME = "$(TARGET_NAME)"; 651 | TARGETED_DEVICE_FAMILY = 1; 652 | }; 653 | name = Release; 654 | }; 655 | /* End XCBuildConfiguration section */ 656 | 657 | /* Begin XCConfigurationList section */ 658 | C42E88381F32FC1800C0F084 /* Build configuration list for PBXProject "BAContact" */ = { 659 | isa = XCConfigurationList; 660 | buildConfigurations = ( 661 | C42E88511F32FC1800C0F084 /* Debug */, 662 | C42E88521F32FC1800C0F084 /* Release */, 663 | ); 664 | defaultConfigurationIsVisible = 0; 665 | defaultConfigurationName = Release; 666 | }; 667 | C42E88531F32FC1800C0F084 /* Build configuration list for PBXNativeTarget "BAContact" */ = { 668 | isa = XCConfigurationList; 669 | buildConfigurations = ( 670 | C42E88541F32FC1800C0F084 /* Debug */, 671 | C42E88551F32FC1800C0F084 /* Release */, 672 | ); 673 | defaultConfigurationIsVisible = 0; 674 | defaultConfigurationName = Release; 675 | }; 676 | /* End XCConfigurationList section */ 677 | }; 678 | rootObject = C42E88351F32FC1800C0F084 /* Project object */; 679 | } 680 | -------------------------------------------------------------------------------- /BAContact.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BAContact.xcodeproj/project.xcworkspace/xcuserdata/1piao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact.xcodeproj/project.xcworkspace/xcuserdata/1piao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /BAContact.xcodeproj/project.xcworkspace/xcuserdata/boai.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact.xcodeproj/project.xcworkspace/xcuserdata/boai.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /BAContact.xcodeproj/xcuserdata/1piao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /BAContact.xcodeproj/xcuserdata/1piao.xcuserdatad/xcschemes/BAContact.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /BAContact.xcodeproj/xcuserdata/1piao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BAContact.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C42E883C1F32FC1800C0F084 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /BAContact.xcodeproj/xcuserdata/boai.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /BAContact.xcodeproj/xcuserdata/boai.xcuserdatad/xcschemes/BAContact.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /BAContact.xcodeproj/xcuserdata/boai.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BAContact.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | C42E883C1F32FC1800C0F084 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /BAContact/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/3. 6 | // Copyright © 2017年 boai. 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 | -------------------------------------------------------------------------------- /BAContact/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/3. 6 | // Copyright © 2017年 boai. 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 | 21 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 22 | self.window.backgroundColor = [UIColor whiteColor]; 23 | 24 | ViewController *vc = [[ViewController alloc] init]; 25 | 26 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; 27 | 28 | self.window.rootViewController = nav; 29 | [self.window makeKeyAndVisible]; 30 | 31 | return YES; 32 | } 33 | 34 | 35 | - (void)applicationWillResignActive:(UIApplication *)application { 36 | // 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. 37 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 38 | } 39 | 40 | 41 | - (void)applicationDidEnterBackground:(UIApplication *)application { 42 | // 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. 43 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 44 | } 45 | 46 | 47 | - (void)applicationWillEnterForeground:(UIApplication *)application { 48 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 49 | } 50 | 51 | 52 | - (void)applicationDidBecomeActive:(UIApplication *)application { 53 | // 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. 54 | } 55 | 56 | 57 | - (void)applicationWillTerminate:(UIApplication *)application { 58 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 59 | } 60 | 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /BAContact/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /BAContact/BAAlertController/BAAlertController.h: -------------------------------------------------------------------------------- 1 | // 2 | // BAAlertController.h 3 | // BAAlertController 4 | // 5 | // Created by boai on 2017/6/5. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #ifndef BAAlertController_h 10 | #define BAAlertController_h 11 | 12 | #import "UIAlertController+BAKit.h" 13 | #import "NSObject+BARunTime.h" 14 | #import "NSMutableAttributedString+BAKit.h" 15 | 16 | /*! 17 | ********************************************************************************* 18 | ************************************ 更新说明 ************************************ 19 | ********************************************************************************* 20 | 21 | 欢迎使用 BAHome 系列开源代码 ! 22 | 如有更多需求,请前往:https://github.com/BAHome 23 | 24 | 项目源码地址: 25 | OC 版 :https://github.com/BAHome/BAAlertController 26 | 27 | 最新更新时间:2017-07-21 【倒叙】
28 | 最新Version:【Version:1.0.2】
29 | 更新内容:
30 | 1.0.2.1、优化内部细节命名,不影响外部使用
31 | 32 | 最新更新时间:2017-06-24 【倒叙】
33 | 最新Version:【Version:1.0.1】
34 | 更新内容:
35 | 1.0.1.1、更换方法名,原:ba_alert2ShowInViewController 替换为:ba_alertTextFieldShowInViewController
36 | 37 | 最新更新时间:2017-06-05 【倒叙】 38 | 最新Version:【Version:1.0.0】 39 | 更新内容: 40 | 1.0.0.1、普通的 UIAlertController-alert,可以自由设置按钮数量、按钮颜色 41 | 1.0.0.2、普通的 UIAlertController-alert,可以自由设置按钮数量、按钮颜色【多按钮样式,颜色数组和title数组个数不等】 42 | 1.0.0.3、普通的 带 textField 的 UIAlertController-alert,可添加一个或者多个 textField 43 | 1.0.0.4、NSMutableAttributedString 的UIAlertController-alert,可以自由设置 NSMutableAttributedString(title、message)按钮数量、按钮颜色 44 | 1.0.0.5、普通的 UIAlertController-actionSheet,可以自由设置按钮数量、按钮颜色 45 | 1.0.0.6、NSMutableAttributedString 的UIAlertController-actionSheet,可以自由设置 NSMutableAttributedString(title、message)按钮数量、按钮颜色 46 | 1.0.0.7、完美适配 iPhone 和 iPad 版本 47 | 1.0.0.8、理论完全兼容现有 iOS 8 以上系统版本 48 | 49 | */ 50 | 51 | #endif /* BAAlertController_h */ 52 | -------------------------------------------------------------------------------- /BAContact/BAAlertController/BAKit_ConfigurationDefine.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * 5 | * @brief BAKit 6 | * 7 | * @author 博爱 8 | * @copyright Copyright © 2016年 博爱. All rights reserved. 9 | * @version V1.0 10 | */ 11 | 12 | // _ooOoo_ 13 | // o8888888o 14 | // 88" . "88 15 | // (| -_- |) 16 | // O\ = /O 17 | // ____/`---'\____ 18 | // . ' \\| |// `. 19 | // / \\||| : |||// \ 20 | // / _||||| -:- |||||- \ 21 | // | | \\\ - /// | | 22 | // | \_| ''\---/'' | | 23 | // \ .-\__ `-` ___/-. / 24 | // ___`. .' /--.--\ `. . __ 25 | // ."" '< `.___\_<|>_/___.' >'"". 26 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 27 | // \ \ `-. \_ __\ /__ _/ .-` / / 28 | // ======`-.____`-.___\_____/___.-`____.-'====== 29 | // `=---=' 30 | // 31 | // ............................................. 32 | // 佛祖镇楼 BUG辟易 33 | // 佛曰: 34 | // 写字楼里写字间,写字间里程序员; 35 | // 程序人员写程序,又拿程序换酒钱。 36 | // 酒醒只在网上坐,酒醉还来网下眠; 37 | // 酒醉酒醒日复日,网上网下年复年。 38 | // 但愿老死电脑间,不愿鞠躬老板前; 39 | // 奔驰宝马贵者趣,公交自行程序员。 40 | // 别人笑我忒疯癫,我笑自己命太贱; 41 | // 不见满街漂亮妹,哪个归得程序员? 42 | 43 | /* 44 | 45 | ********************************************************************************* 46 | * 47 | * 在使用 BAKit 的过程中如果出现 bug 请及时以以下任意一种方式联系我,我会及时修复 bug 48 | * 49 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 50 | * 微博 : 博爱1616 51 | * Email : 137361770@qq.com 52 | * GitHub : https://github.com/boai 53 | * BAHome : https://github.com/BAHome 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | 61 | #ifndef BAKit_ConfigurationDefine_h 62 | #define BAKit_ConfigurationDefine_h 63 | 64 | 65 | #ifndef __OPTIMIZE__ 66 | #define NSLog(...) NSLog(__VA_ARGS__) 67 | #else 68 | #define NSLog(...){} 69 | #endif 70 | 71 | #pragma mark - weak / strong 72 | #define BAKit_WeakSelf @BAKit_Weakify(self); 73 | #define BAKit_StrongSelf @BAKit_Strongify(self); 74 | 75 | /*! 76 | * 强弱引用转换,用于解决代码块(block)与强引用self之间的循环引用问题 77 | * 调用方式: `@BAKit_Weakify`实现弱引用转换,`@BAKit_Strongify`实现强引用转换 78 | * 79 | * 示例: 80 | * @BAKit_Weakify 81 | * [obj block:^{ 82 | * @strongify_self 83 | * self.property = something; 84 | * }]; 85 | */ 86 | #ifndef BAKit_Weakify 87 | #if DEBUG 88 | #if __has_feature(objc_arc) 89 | #define BAKit_Weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object; 90 | #else 91 | #define BAKit_Weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object; 92 | #endif 93 | #else 94 | #if __has_feature(objc_arc) 95 | #define BAKit_Weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object; 96 | #else 97 | #define BAKit_Weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object; 98 | #endif 99 | #endif 100 | #endif 101 | 102 | /*! 103 | * 强弱引用转换,用于解决代码块(block)与强引用对象之间的循环引用问题 104 | * 调用方式: `@BAKit_Weakify(object)`实现弱引用转换,`@BAKit_Strongify(object)`实现强引用转换 105 | * 106 | * 示例: 107 | * @BAKit_Weakify(object) 108 | * [obj block:^{ 109 | * @BAKit_Strongify(object) 110 | * strong_object = something; 111 | * }]; 112 | */ 113 | #ifndef BAKit_Strongify 114 | #if DEBUG 115 | #if __has_feature(objc_arc) 116 | #define BAKit_Strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object; 117 | #else 118 | #define BAKit_Strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object; 119 | #endif 120 | #else 121 | #if __has_feature(objc_arc) 122 | #define BAKit_Strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object; 123 | #else 124 | #define BAKit_Strongify(object) try{} @finally{} __typeof__(object) object = block##_##object; 125 | #endif 126 | #endif 127 | #endif 128 | 129 | /*! 获取sharedApplication */ 130 | #define BAKit_SharedApplication [UIApplication sharedApplication] 131 | 132 | // 操作系统版本号 133 | #define BAKit_IOS_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue]) 134 | 135 | /*! 主线程同步队列 */ 136 | #define dispatch_main_sync_safe(block)\ 137 | if ([NSThread isMainThread]) {\ 138 | block();\ 139 | } else {\ 140 | dispatch_sync(dispatch_get_main_queue(), block);\ 141 | } 142 | /*! 主线程异步队列 */ 143 | #define dispatch_main_async_safe(block)\ 144 | if ([NSThread isMainThread]) {\ 145 | block();\ 146 | } else {\ 147 | dispatch_async(dispatch_get_main_queue(), block);\ 148 | } 149 | 150 | 151 | #pragma mark - runtime 152 | #import 153 | /*! runtime set */ 154 | #define BAKit_Objc_setObj(key, value) objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC) 155 | 156 | /*! runtime setCopy */ 157 | #define BAKit_Objc_setObjCOPY(key, value) objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_COPY) 158 | 159 | /*! runtime get */ 160 | #define BAKit_Objc_getObj objc_getAssociatedObject(self, _cmd) 161 | 162 | /*! runtime exchangeMethod */ 163 | #define BAKit_Objc_exchangeMethodAToB(originalSelector,swizzledSelector) { \ 164 | Method originalMethod = class_getInstanceMethod(self, originalSelector); \ 165 | Method swizzledMethod = class_getInstanceMethod(self, swizzledSelector); \ 166 | if (class_addMethod(self, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) { \ 167 | class_replaceMethod(self, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); \ 168 | } else { \ 169 | method_exchangeImplementations(originalMethod, swizzledMethod); \ 170 | } \ 171 | } 172 | 173 | #pragma mark - 简单警告框 174 | /*! view 用 BAKit_ShowAlertWithMsg */ 175 | #define BAKit_ShowAlertWithMsg(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:(msg) delegate:nil cancelButtonTitle:@"确 定" otherButtonTitles:nil] show]; 176 | /*! VC 用 BAKit_ShowAlertWithMsg */ 177 | #define BAKit_ShowAlertWithMsg_ios8(msg) UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:msg preferredStyle:UIAlertControllerStyleAlert];\ 178 | UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确 定" style:UIAlertActionStyleDefault handler:nil];\ 179 | [alert addAction:sureAction];\ 180 | [self presentViewController:alert animated:YES completion:nil]; 181 | 182 | #pragma mark - color 183 | CG_INLINE UIColor * 184 | BAKit_Color_RGBA_pod(u_char r,u_char g, u_char b, u_char a) { 185 | return [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]; 186 | } 187 | 188 | CG_INLINE UIColor * 189 | BAKit_Color_RGB_pod(u_char r,u_char g, u_char b) { 190 | return BAKit_Color_RGBA_pod(r, g, b, 1.0); 191 | } 192 | 193 | CG_INLINE UIColor * 194 | BAKit_Color_RGBValue_pod(UInt32 rgbValue){ 195 | return [UIColor colorWithRed:((rgbValue & 0xff0000) >> 16) / 255.0f 196 | green:((rgbValue & 0xff00) >> 8) / 255.0f 197 | blue:(rgbValue & 0xff) / 255.0f 198 | alpha:1.0f]; 199 | } 200 | 201 | CG_INLINE UIColor * 202 | BAKit_Color_RGBAValue_pod(UInt32 rgbaValue){ 203 | return [UIColor colorWithRed:((rgbaValue & 0xff000000) >> 24) / 255.0f 204 | green:((rgbaValue & 0xff0000) >> 16) / 255.0f 205 | blue:((rgbaValue & 0xff00) >> 8) / 255.0f 206 | alpha:(rgbaValue & 0xff) / 255.0f]; 207 | } 208 | 209 | CG_INLINE UIColor * 210 | BAKit_Color_RandomRGB_pod(){ 211 | return BAKit_Color_RGBValue_pod(arc4random_uniform(0xffffff)); 212 | } 213 | 214 | CG_INLINE UIColor * 215 | BAKit_Color_RandomRGBA_pod(){ 216 | return BAKit_Color_RGBAValue_pod(arc4random_uniform(0xffffffff)); 217 | } 218 | 219 | 220 | #define BAKit_Color_Translucent_pod [UIColor colorWithRed:0.3f green:0.3f blue:0.3f alpha:0.5f] 221 | #define BAKit_Color_White_pod [UIColor whiteColor] 222 | #define BAKit_Color_Clear_pod [UIColor clearColor] 223 | #define BAKit_Color_Black_pod [UIColor blackColor] 224 | #define BAKit_Color_White_pod [UIColor whiteColor] 225 | #define BAKit_Color_Red_pod [UIColor redColor] 226 | #define BAKit_Color_Green_pod [UIColor greenColor] 227 | #define BAKit_Color_Orange_pod [UIColor orangeColor] 228 | #define BAKit_Color_Yellow_pod [UIColor yellowColor] 229 | 230 | 231 | /*! 灰色 */ 232 | #define BAKit_Color_Gray_1_pod BAKit_Color_RGB_pod(53, 60, 70) 233 | #define BAKit_Color_Gray_2_pod BAKit_Color_RGB_pod(73, 80, 90) 234 | #define BAKit_Color_Gray_3_pod BAKit_Color_RGB_pod(93, 100, 110) 235 | #define BAKit_Color_Gray_4_pod BAKit_Color_RGB_pod(113, 120, 130) 236 | #define BAKit_Color_Gray_5_pod BAKit_Color_RGB_pod(133, 140, 150) 237 | #define BAKit_Color_Gray_6_pod BAKit_Color_RGB_pod(153, 160, 170) 238 | #define BAKit_Color_Gray_7_pod BAKit_Color_RGB_pod(173, 180, 190) 239 | #define BAKit_Color_Gray_8_pod BAKit_Color_RGB_pod(196, 200, 208) 240 | #define BAKit_Color_Gray_9_pod BAKit_Color_RGB_pod(216, 220, 228) 241 | #define BAKit_Color_Gray_10_pod BAKit_Color_RGB_pod(240, 240, 240) 242 | #define BAKit_Color_Gray_11_pod BAKit_Color_RGB_pod(248, 248, 248) 243 | 244 | #pragma mark - Margin 245 | #define BAKit_Margin_1_pod BAKit_Flat_pod(1) 246 | #define BAKit_Margin_2_pod BAKit_Flat_pod(2) 247 | #define BAKit_Margin_5_pod BAKit_Flat_pod(5) 248 | #define BAKit_Margin_10_pod BAKit_Flat_pod(10) 249 | #define BAKit_Margin_15_pod BAKit_Flat_pod(15) 250 | #define BAKit_Margin_20_pod BAKit_Flat_pod(20) 251 | #define BAKit_Margin_25_pod BAKit_Flat_pod(25) 252 | #define BAKit_Margin_30_pod BAKit_Flat_pod(30) 253 | #define BAKit_Margin_35_pod BAKit_Flat_pod(35) 254 | #define BAKit_Margin_40_pod BAKit_Flat_pod(40) 255 | #define BAKit_Margin_44_pod BAKit_Flat_pod(44) 256 | #define BAKit_Margin_50_pod BAKit_Flat_pod(50) 257 | #define BAKit_Margin_100_pod BAKit_Flat_pod(100) 258 | #define BAKit_Margin_150_pod BAKit_Flat_pod(150) 259 | 260 | 261 | #define BAKit_ImageName(imageName) [UIImage imageNamed:imageName] 262 | 263 | #pragma mark - NotiCenter other 264 | #define BAKit_NotiCenter [NSNotificationCenter defaultCenter] 265 | 266 | #define BAKit_NSUserDefaults [NSUserDefaults standardUserDefaults] 267 | 268 | /*! 获取sharedApplication */ 269 | #define BAKit_SharedApplication [UIApplication sharedApplication] 270 | 271 | /*! 用safari打开URL */ 272 | #define BAKit_OpenUrl(urlStr) [BAKit_SharedApplication openURL:[NSURL URLWithString:urlStr]] 273 | 274 | /*! 复制文字内容 */ 275 | #define BAKit_CopyContent(content) [[UIPasteboard generalPasteboard] setString:content] 276 | 277 | 278 | /*! 279 | * 获取屏幕宽度和高度 280 | */ 281 | #define BAKit_SCREEN_WIDTH ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height) 282 | 283 | #define BAKit_SCREEN_HEIGHT ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.height : [[UIScreen mainScreen] bounds].size.width) 284 | 285 | #define BAKit_BaseScreenWidth 320.0f 286 | #define BAKit_BaseScreenHeight 568.0f 287 | 288 | /*! 屏幕适配(5S标准屏幕:320 * 568) */ 289 | // iPhone 7 屏幕:375 * 667 290 | //376/320 = 291 | //667/568 = 292 | #define BAKit_ScaleXAndWidth BAKit_SCREEN_WIDTH/BAKit_BaseScreenWidth 293 | #define BAKit_ScaleYAndHeight BAKit_SCREEN_HEIGHT/BAKit_BaseScreenHeight 294 | 295 | #define BAKit_ScreenScale ([[UIScreen mainScreen] scale]) 296 | 297 | CG_INLINE BOOL 298 | BAKit_stringIsBlank_pod(NSString *string) { 299 | NSCharacterSet *blank = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 300 | for (NSInteger i = 0; i < string.length; ++i) { 301 | unichar c = [string characterAtIndex:i]; 302 | if (![blank characterIsMember:c]) { 303 | return NO; 304 | } 305 | } 306 | return YES; 307 | } 308 | 309 | /** 310 | * 基于指定的倍数,对传进来的 floatValue 进行像素取整。若指定倍数为0,则表示以当前设备的屏幕倍数为准。 311 | * 312 | * 例如传进来 “2.1”,在 2x 倍数下会返回 2.5(0.5pt 对应 1px),在 3x 倍数下会返回 2.333(0.333pt 对应 1px)。 313 | */ 314 | CG_INLINE CGFloat 315 | BAKit_FlatSpecificScale_pod(CGFloat floatValue, CGFloat scale) { 316 | scale = scale == 0 ? BAKit_ScreenScale : scale; 317 | CGFloat flattedValue = ceil(floatValue * scale) / scale; 318 | return flattedValue; 319 | } 320 | 321 | /** 322 | * 基于当前设备的屏幕倍数,对传进来的 floatValue 进行像素取整。 323 | * 324 | * 注意如果在 Core Graphic 绘图里使用时,要注意当前画布的倍数是否和设备屏幕倍数一致,若不一致,不可使用 flat() 函数,而应该用 flatSpecificScale 325 | */ 326 | CG_INLINE CGFloat 327 | BAKit_Flat_pod(CGFloat floatValue) { 328 | return BAKit_FlatSpecificScale_pod(floatValue, 0); 329 | } 330 | 331 | /// 将一个CGSize像素对齐 332 | CG_INLINE CGSize 333 | BAKit_CGSizeFlatted_pod(CGSize size) { 334 | return CGSizeMake(BAKit_Flat_pod(size.width), BAKit_Flat_pod(size.height)); 335 | } 336 | 337 | /// 创建一个像素对齐的CGRect 338 | CG_INLINE CGRect 339 | BAKit_CGRectFlatMake_pod(CGFloat x, CGFloat y, CGFloat width, CGFloat height) { 340 | return CGRectMake(BAKit_Flat_pod(x), BAKit_Flat_pod(y), BAKit_Flat_pod(width), BAKit_Flat_pod(height)); 341 | } 342 | 343 | /** 344 | 计算列数【根据 array.count、每行多少个 item,计算列数】 345 | 346 | @param array array 347 | @param rowCount 每行多少个 item 348 | @return 列数 349 | */ 350 | CG_INLINE NSInteger 351 | BAKit_getColumnCountWithArrayAndRowCount_pod(NSArray *array, NSInteger rowCount){ 352 | NSUInteger count = array.count; 353 | 354 | NSUInteger i = 0; 355 | if (count % rowCount == 0) 356 | { 357 | i = count / rowCount; 358 | } 359 | else 360 | { 361 | i = count / rowCount + 1; 362 | } 363 | return i; 364 | } 365 | 366 | 367 | #endif /* BAKit_ConfigurationDefine_h */ 368 | -------------------------------------------------------------------------------- /BAContact/BAAlertController/NSMutableAttributedString+BAKit.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | 61 | #import 62 | #import 63 | 64 | @interface NSMutableAttributedString (BAKit) 65 | #pragma mark - ***** 富文本处理 类 66 | 67 | /*! 完全自定义样式 */ 68 | - (void)ba_changeAttributeDict:(NSDictionary *)dict range:(NSRange)range; 69 | 70 | /*! 改变某位置的颜色 */ 71 | - (void)ba_changeColor:(UIColor *)color range:(NSRange)range; 72 | 73 | /*! 设置字体所在区域背景颜色,取值为 UIColor对象,默认值为nil, 透明色 */ 74 | - (void)ba_changeBackgroundColor:(UIColor *)color range:(NSRange)range; 75 | 76 | ///*! 设置连体属性,取值为NSNumber 对象(整数),0 表示没有连体字符,1 表示使用默认的连体字符, // 2 表示使用所有连体符号,默认值为 1(iOS 不支持 2) */ 77 | //- (void)ba_changeLigatureWithValue:(int)value range:(NSRange)range; 78 | 79 | /*! 改变某位置的普通字号 */ 80 | - (void)ba_changeSystemFont:(UIFont *)font range:(NSRange)range; 81 | 82 | /*! 设置字形倾斜度,取值为 NSNumber(float),正值右倾,负值左倾 */ 83 | - (void)ba_changeObliquenessValue:(NSNumber *)value range:(NSRange)range; 84 | 85 | /*! 设置文字排版方向,取值为 NSNumber 对象(整数),0 表示横排文本,1 表示竖排文本 */ 86 | - (void)ba_changeVerticalGlyphFormValue:(NSNumber *)value range:(NSRange)range; 87 | 88 | /*! 设置文字书写方向,从左向右书写或者从右向左书写 */ 89 | - (void)ba_changeWritingDirectionStyle:(NSWritingDirection)style; 90 | 91 | /*! 改变某位置的行距 */ 92 | - (void)ba_changeLineSpacing:(CGFloat)spacing 93 | from:(NSInteger)loc 94 | length:(NSInteger)length; 95 | 96 | /*! 改变某位置的段落距离 */ 97 | - (void)ba_changeParagraphSpacing:(CGFloat)spacing 98 | from:(NSInteger)loc 99 | length:(NSInteger)length; 100 | 101 | /*! 改变段的顶部和文本内容的开头之间的距离 */ 102 | - (void)ba_changeBeforeLparagraphSpacing:(CGFloat)spacing 103 | from:(NSInteger)loc 104 | length:(NSInteger)length; 105 | 106 | /*! 设置下划线样式:根据枚举选择 */ 107 | - (void)ba_changeUnderlineStyle:(NSUnderlineStyle)style color:(UIColor *)color Range:(NSRange)range; 108 | /*! 全部加下划线 设置下划线样式:根据枚举选择 */ 109 | - (void)ba_changeUnderlineAtAllStyle:(NSUnderlineStyle)style color:(UIColor *)color; 110 | 111 | /*! 设置删除线样式:根据枚举选择 */ 112 | - (void)ba_changeStrikethroughStyle:(NSUnderlineStyle)style color:(UIColor *)color Range:(NSRange)range; 113 | /*! 全部添加删除线 设置删除线样式:根据枚举选择 */ 114 | - (void)ba_changeStrikethroughAtAllStyle:(NSUnderlineStyle)style color:(UIColor *)color; 115 | 116 | /*! 设定字符间距,取值为 NSNumber 对象(整数),正值间距加宽,负值间距变窄 */ 117 | - (void)ba_changeKernWithValue:(NSNumber *)value Range:(NSRange)range; 118 | 119 | /*! 根据位置设置文本横向拉伸属性,取值为 NSNumber (float),正值横向拉伸文本,负值横向压缩文本 */ 120 | - (void)ba_changeExpansionWithValue:(NSNumber *)value Range:(NSRange)range; 121 | #pragma mark 122 | 123 | /*! 根据位置添加阴影效果 */ 124 | - (void)ba_changeShadowWithShadow:(NSShadow *)shadow Range:(NSRange)range; 125 | 126 | /*! 根据位置修改描边颜色 */ 127 | - (void)ba_changeStrokeColorWithColor:(UIColor *)strokeColor 128 | strokeWidth:(NSNumber *)strokeWidth 129 | Range:(NSRange)range; 130 | 131 | /*! 132 | * 133 | * 实例化 NSMutableAttributedString 字符串 134 | * 135 | * @param texts 用于存储所需设置字符串的数组(根据所需自定义类型分组) 136 | * @param attrsArray 富文本属性样式的集合(数组元素是texts的相应文本的属性--字典) 137 | * @param space texts文本之间的间距数组 1 代表一个空格的距离 138 | * 139 | * @return NSMutableAttributedString实例 140 | */ 141 | - (instancetype)initWithStrings:(NSArray *)texts 142 | attributesArray:(NSArray *>*)attrsArray 143 | space:(NSArray *)space; 144 | 145 | @end 146 | -------------------------------------------------------------------------------- /BAContact/BAAlertController/NSMutableAttributedString+BAKit.m: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客园 : http://www.cnblogs.com/boai/ 55 | * 博客 : http://boaihome.com 56 | * 简书 : http://www.jianshu.com/users/95c9800fdf47/latest_articles 57 | * 简书专题 : http://www.jianshu.com/collection/072d578bf782 58 | 59 | ********************************************************************************* 60 | 61 | */ 62 | 63 | 64 | #import "NSMutableAttributedString+BAKit.h" 65 | 66 | @implementation NSMutableAttributedString (BAKit) 67 | 68 | #pragma mark 完全自定义样式 69 | - (void)ba_changeAttributeDict:(NSDictionary *)dict range:(NSRange)range 70 | { 71 | [self addAttributes:dict range:range]; 72 | } 73 | 74 | #pragma mark 设置字体颜色,取值为 UIColor,默认为黑色 75 | - (void)ba_changeColor:(UIColor *)color range:(NSRange)range 76 | { 77 | [self addAttribute:NSForegroundColorAttributeName value:color range:range]; 78 | } 79 | 80 | #pragma mark 设置字体所在区域背景颜色,取值为 UIColor对象,默认值为nil, 透明色 81 | //#warning NSForegroundColorAttributeName 和 NSBackgroundColorAttributeName 的低位是相等的,跟前面介绍的 textColor 一样,哪个属性最后一次赋值,就会冲掉前面的效果 82 | - (void)ba_changeBackgroundColor:(UIColor *)color range:(NSRange)range 83 | { 84 | [self addAttribute:NSBackgroundColorAttributeName value:color range:range]; 85 | } 86 | 87 | //#pragma mark 设置连体属性,取值为NSNumber 对象(整数),0 表示没有连体字符,1 表示使用默认的连体字符, // 2 表示使用所有连体符号,默认值为 1(iOS 不支持 2) 88 | //- (void)ba_changeLigatureWithValue:(int)value range:(NSRange)range 89 | //{ 90 | // [self addAttribute:NSLigatureAttributeName value:[NSNumber numberWithInt: value] range:range]; 91 | // // return range; 92 | //} 93 | 94 | #pragma mark 改变某位置 设置字体属性,默认值:字体:Helvetica(Neue) 字号:12 95 | - (void)ba_changeSystemFont:(UIFont *)font range:(NSRange)range 96 | { 97 | [self addAttribute:NSFontAttributeName value:font range:range]; 98 | } 99 | 100 | #pragma mark 设置字形倾斜度,取值为 NSNumber(float),正值右倾,负值左倾 101 | - (void)ba_changeObliquenessValue:(NSNumber *)value range:(NSRange)range 102 | { 103 | [self addAttribute:NSObliquenessAttributeName value:value range:range]; 104 | } 105 | 106 | #pragma mark NSVerticalGlyphFormAttributeName 设置文字排版方向,取值为 NSNumber 对象(整数),0 表示横排文本,1 表示竖排文本 在 iOS 中,总是使用横排文本,0 以外的值都未定义 107 | - (void)ba_changeVerticalGlyphFormValue:(NSNumber *)value range:(NSRange)range 108 | { 109 | [self addAttribute:NSVerticalGlyphFormAttributeName value:value range:range]; 110 | } 111 | 112 | #pragma mark NSWritingDirectionAttributeName 设置文字书写方向,从左向右书写或者从右向左书写 113 | - (void)ba_changeWritingDirectionStyle:(NSWritingDirection)style 114 | { 115 | [self addAttribute:NSWritingDirectionAttributeName value:@[@(NSWritingDirectionRightToLeft)] range:NSMakeRange(0, self.length)]; 116 | } 117 | 118 | #pragma mark 改变某位置的行距 119 | - (void)ba_changeLineSpacing:(CGFloat)spacing 120 | from:(NSInteger)loc 121 | length:(NSInteger)length 122 | { 123 | NSRange range = NSMakeRange(loc, length); 124 | NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; 125 | /*! 行距 */ 126 | style.lineSpacing = spacing; 127 | [self addAttribute:NSParagraphStyleAttributeName value:style range:range]; 128 | } 129 | 130 | /*! 改变某位置的段落距离 */ 131 | - (void)ba_changeParagraphSpacing:(CGFloat)spacing 132 | from:(NSInteger)loc 133 | length:(NSInteger)length 134 | { 135 | NSRange range = NSMakeRange(loc, length); 136 | NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; 137 | /*! 段落距离 */ 138 | style.paragraphSpacing = spacing; 139 | [self addAttribute:NSParagraphStyleAttributeName value:style range:range]; 140 | } 141 | 142 | #pragma mark 改变段落的顶部和文本内容的开头之间的距离 143 | - (void)ba_changeBeforeLparagraphSpacing:(CGFloat)spacing 144 | from:(NSInteger)loc 145 | length:(NSInteger)length 146 | { 147 | NSRange range = NSMakeRange(loc, length); 148 | NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; 149 | /*! 段落的顶部和文本内容的开头之间的距离 */ 150 | style.paragraphSpacingBefore = spacing; 151 | [self addAttribute:NSParagraphStyleAttributeName value:style range:range]; 152 | } 153 | 154 | #pragma mark 设置下划线样式:根据枚举选择 155 | - (void)ba_changeUnderlineStyle:(NSUnderlineStyle)style color:(UIColor *)color Range:(NSRange)range 156 | { 157 | [self addAttribute:NSUnderlineStyleAttributeName value:[NSNumber numberWithInteger:style] range:range]; 158 | [self addAttribute:NSUnderlineColorAttributeName value:color range:range]; 159 | } 160 | 161 | #pragma mark 全部加下划线 设置下划线样式:根据枚举选择 162 | - (void)ba_changeUnderlineAtAllStyle:(NSUnderlineStyle)style color:(UIColor *)color 163 | { 164 | NSRange range = NSMakeRange(0, self.length); 165 | [self ba_changeUnderlineStyle:style color:color Range:range]; 166 | } 167 | 168 | #pragma mark 设置删除线样式:根据枚举选择 169 | - (void)ba_changeStrikethroughStyle:(NSUnderlineStyle)style color:(UIColor *)color Range:(NSRange)range 170 | { 171 | [self addAttribute:NSStrikethroughStyleAttributeName value:[NSNumber numberWithInteger:style] range:range]; 172 | [self addAttribute:NSStrikethroughColorAttributeName value:color range:range]; 173 | } 174 | 175 | #pragma mark 全部添加删除线 设置删除线样式:根据枚举选择 176 | - (void)ba_changeStrikethroughAtAllStyle:(NSUnderlineStyle)style color:(UIColor *)color 177 | { 178 | NSRange range = NSMakeRange(0, self.length); 179 | [self ba_changeStrikethroughStyle:style color:color Range:range]; 180 | } 181 | 182 | #pragma mark 设定字符间距,取值为 NSNumber 对象(整数),正值间距加宽,负值间距变窄 183 | - (void)ba_changeKernWithValue:(NSNumber *)value Range:(NSRange)range 184 | { 185 | [self addAttribute:NSKernAttributeName value:value range:range]; 186 | } 187 | 188 | #pragma mark 根据位置设置文本横向拉伸属性,取值为 NSNumber (float),正值横向拉伸文本,负值横向压缩文本 189 | - (void)ba_changeExpansionWithValue:(NSNumber *)value Range:(NSRange)range 190 | { 191 | [self addAttribute:NSExpansionAttributeName value:value range:range]; 192 | } 193 | 194 | #pragma mark 根据位置添加阴影效果 195 | - (void)ba_changeShadowWithShadow:(NSShadow *)shadow Range:(NSRange)range 196 | { 197 | [self addAttribute:NSShadowAttributeName value:shadow range:range]; 198 | /*! 排版 */ 199 | [self addAttribute:NSVerticalGlyphFormAttributeName value:@(0) range:range]; 200 | } 201 | 202 | #pragma mark 根据位置修改描边颜色 垂直标志符号形式 203 | - (void)ba_changeStrokeColorWithColor:(UIColor *)strokeColor 204 | strokeWidth:(NSNumber *)strokeWidth 205 | Range:(NSRange)range 206 | { 207 | [self addAttribute:NSStrokeColorAttributeName value:strokeColor range:range]; 208 | [self addAttribute:NSStrokeWidthAttributeName value:strokeWidth range:range]; 209 | } 210 | 211 | - (instancetype)initWithStrings:(NSArray *)texts 212 | attributesArray:(NSArray *>*)attrsArray 213 | space:(NSArray *)space 214 | { 215 | if (self = [super init]) 216 | { 217 | 218 | } 219 | return [self go:texts andAttributesArray:attrsArray space:space]; 220 | } 221 | 222 | - (instancetype)go:(NSArray *)textArray andAttributesArray:(NSArray *)attrsArray space:(NSArray *)space 223 | { 224 | __block NSMutableAttributedString *string = [[NSMutableAttributedString alloc]init]; 225 | 226 | __weak typeof(self)weakSelf = self; 227 | [textArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { 228 | __strong typeof(weakSelf) strongSelf = weakSelf; 229 | NSUInteger attrsCount = attrsArray.count; 230 | if (idx <= (attrsCount-1) ) 231 | { 232 | [string appendAttributedString:[strongSelf initWithString:obj attributes:attrsArray[idx]]]; 233 | } 234 | else 235 | { 236 | [string appendAttributedString:[strongSelf initWithString:obj attributes:attrsArray[attrsCount-1]]]; 237 | } 238 | 239 | if (idx != textArray.count-1 && idx <= space.count-1) 240 | { 241 | [string appendAttributedString:[self spaceWidthWithNumberBlackSpace:space[idx]]]; 242 | } 243 | else 244 | { 245 | [string appendAttributedString:[self spaceWidthWithNumberBlackSpace:0]]; 246 | } 247 | }]; 248 | 249 | return string; 250 | } 251 | 252 | - (NSMutableAttributedString *)spaceWidthWithNumberBlackSpace:(NSNumber *)number 253 | { 254 | NSString *string = @""; 255 | NSUInteger count = [number integerValue]; 256 | for (NSUInteger i = 0;i < count ; i++) 257 | { 258 | string = [string stringByAppendingFormat:@" "]; 259 | } 260 | NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:string]; 261 | return attributedString; 262 | } 263 | 264 | @end 265 | -------------------------------------------------------------------------------- /BAContact/BAAlertController/NSObject+BARunTime.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | /** 61 | * - 添加运行时分类方法 62 | * - 用于运行时动态获取当前类的属性列表、方法列表、成员变量列表、协议列表 63 | * - 性能优化 64 | */ 65 | #import 66 | 67 | @interface NSObject (BARunTime) 68 | 69 | /** 70 | * 将 ‘字典数组‘ 转换成当前模型的对象数组 71 | * 72 | * @param array 字典数组 73 | * 74 | * @return 返回模型对象的数组 75 | */ 76 | + (NSArray *)ba_objectsWithArray:(NSArray *)array; 77 | 78 | /** 79 | * 返回当前类的所有属性列表 80 | * 81 | * @return 属性名称 82 | */ 83 | + (NSArray *)ba_propertysList; 84 | 85 | /** 86 | * 返回当前类的所有成员变量数组 87 | * 88 | * @return 当前类的所有成员变量! 89 | * 90 | * Tips:用于调试, 可以尝试查看所有不开源的类的ivar 91 | */ 92 | + (NSArray *)ba_ivarList; 93 | 94 | /** 95 | * 返回当前类的所有方法 96 | * 97 | * @return 当前类的所有成员变量! 98 | */ 99 | + (NSArray *)ba_methodList; 100 | 101 | /** 102 | * 返回当前类的所有协议 103 | * 104 | * @return 当前类的所有协议! 105 | */ 106 | + (NSArray *)ba_protocolList; 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /BAContact/BAAlertController/NSObject+BARunTime.m: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客园 : http://www.cnblogs.com/boai/ 55 | * 博客 : http://boai.github.io 56 | * 简书 : http://www.jianshu.com/users/95c9800fdf47/latest_articles 57 | * 简书专题 : http://www.jianshu.com/collection/072d578bf782 58 | 59 | ********************************************************************************* 60 | 61 | */ 62 | 63 | 64 | #import "NSObject+BARunTime.h" 65 | #import 66 | 67 | @implementation NSObject (BARunTime) 68 | 69 | #pragma mark - 根据传递进来的所有字典数组 字典转模型 70 | + (NSArray *)ba_objectsWithArray:(NSArray *)array 71 | { 72 | if (array.count == 0) 73 | { 74 | return nil; 75 | } 76 | 77 | // 判断是否是字典数组 78 | NSAssert([array[0] isKindOfClass:[NSDictionary class]], @"必须传入字典数组"); 79 | 80 | // 获取属性列表数组 81 | NSArray *propertyList = [self ba_propertysList]; 82 | 83 | NSMutableArray *arrayM = [NSMutableArray array]; 84 | 85 | for (NSDictionary *dict in array) 86 | { 87 | // 创建模型 88 | id model = [self new]; 89 | 90 | // 遍历数组 91 | for (NSString *key in dict) 92 | { 93 | // 判断属性列表数组中是否包含当前key 如果有, 意味着属性存在 94 | if ([propertyList containsObject:key]) { 95 | // 字典转模型 96 | [model setValue:dict[key] forKey:key]; 97 | } 98 | } 99 | // 添加到可变数组中 100 | [arrayM addObject:model]; 101 | } 102 | return arrayM.copy; 103 | } 104 | 105 | #pragma mark - 获取本类所有 ‘属性‘ 的数组 106 | /** 程序运行的时候动态的获取当前类的属性列表 107 | * 程序运行的时候,类的属性不会变化 108 | */ 109 | const void *ba_propertyListKey = @"ba_propertyListKey"; 110 | + (NSArray *)ba_propertysList 111 | { 112 | NSArray *result = objc_getAssociatedObject(self, ba_propertyListKey); 113 | 114 | if (result != nil) 115 | { 116 | return result; 117 | } 118 | 119 | NSMutableArray *arrayM = [NSMutableArray array]; 120 | // 获取当前类的属性数组 121 | // count -> 属性的数量 122 | unsigned int count = 0; 123 | objc_property_t *list = class_copyPropertyList([self class], &count); 124 | 125 | for (unsigned int i = 0; i < count; i++) { 126 | // 根据下标获取属性 127 | objc_property_t property = list[i]; 128 | 129 | // 获取属性的名字 130 | const char *cName = property_getName(property); 131 | 132 | // 转换成OC字符串 133 | NSString *name = [NSString stringWithUTF8String:cName]; 134 | [arrayM addObject:name]; 135 | } 136 | 137 | /*! ⚠️注意: 一定要释放数组 class_copyPropertyList底层为C语言,所以我们一定要记得释放properties */ 138 | free(list); 139 | 140 | // ---保存属性数组对象--- 141 | objc_setAssociatedObject(self, ba_propertyListKey, arrayM, OBJC_ASSOCIATION_COPY_NONATOMIC); 142 | 143 | return objc_getAssociatedObject(self, ba_propertyListKey); 144 | } 145 | 146 | #pragma mark - 获取本类所有 ‘方法‘ 的数组 147 | const void *ba_methodListKey = "ba_methodListKey"; 148 | + (NSArray *)ba_methodList 149 | { 150 | // 1. 使用运行时动态添加属性 151 | NSArray *methodsList = objc_getAssociatedObject(self, ba_methodListKey); 152 | 153 | // 2. 如果数组中直接返回方法数组 154 | if (methodsList != nil) 155 | { 156 | return methodsList; 157 | } 158 | 159 | // 3. 获取当前类的方法数组 160 | unsigned int count = 0; 161 | Method *list = class_copyMethodList([self class], &count); 162 | 163 | NSMutableArray *arrayM = [NSMutableArray array]; 164 | for (unsigned int i = 0; i < count; i++) 165 | { 166 | // 根据下标获取方法 167 | Method method = list[i]; 168 | 169 | SEL methodName = method_getName(method); 170 | 171 | NSString *methodName_OC = NSStringFromSelector(methodName); 172 | 173 | // IMP imp = method_getImplementation(method); 174 | const char *name_s =sel_getName(method_getName(method)); 175 | int arguments = method_getNumberOfArguments(method); 176 | const char* encoding =method_getTypeEncoding(method); 177 | NSLog(@"方法名:%@,参数个数:%d,编码方式:%@",[NSString stringWithUTF8String:name_s], 178 | arguments, 179 | [NSString stringWithUTF8String:encoding]); 180 | 181 | [arrayM addObject:methodName_OC]; 182 | } 183 | 184 | // 4. 释放数组 185 | free(list); 186 | 187 | // 5. 保存方法的数组对象 188 | objc_setAssociatedObject(self, ba_methodListKey, arrayM, OBJC_ASSOCIATION_COPY_NONATOMIC); 189 | 190 | return objc_getAssociatedObject(self, ba_methodListKey); 191 | } 192 | 193 | 194 | #pragma mark - 获取本类所有 ‘成员变量‘ 的数组 <用来调试> 195 | /** 获取当前类的所有成员变量 */ 196 | const char *ba_ivarListKey = "ba_ivarListKey"; 197 | + (NSArray *)ba_ivarList 198 | { 199 | 200 | // 1. 查询根据key 保存的成员变量数组 201 | NSArray *ivarList = objc_getAssociatedObject(self, ba_ivarListKey); 202 | 203 | // 2. 判断数组中是否有值, 如果有直接返回 204 | if (ivarList != nil) 205 | { 206 | return ivarList; 207 | } 208 | 209 | // 3. 如果数组中没有, 则根据当前类,获取当前类的所有 ‘成员变量‘ 210 | unsigned int count = 0; 211 | Ivar *ivars = class_copyIvarList([self class], &count); 212 | 213 | // 4. 遍历 成员变量 数组, 获取成员变量的名 214 | NSMutableArray *arrayM = [NSMutableArray array]; 215 | for (unsigned int i = 0; i < count; i++) { 216 | Ivar ivar = ivars[i]; 217 | // - C语言的字符串都是 ‘char *‘ 类型的 218 | const char *ivarName_C = ivar_getName(ivar); 219 | 220 | // - 将 C语言的字符串 转换成 OC字符串 221 | NSString *ivarName_OC = [NSString stringWithUTF8String:ivarName_C]; 222 | // - 将本类 ‘成员变量名‘ 添加到数组 223 | [arrayM addObject:ivarName_OC]; 224 | } 225 | 226 | // 5. 释放ivars 227 | free(ivars); 228 | 229 | // 6. 根据key 动态获取保存在关联对象中的数组 230 | objc_setAssociatedObject(self, ba_ivarListKey, arrayM, OBJC_ASSOCIATION_COPY_NONATOMIC); 231 | 232 | return objc_getAssociatedObject(self, ba_ivarListKey); 233 | } 234 | 235 | #pragma mark - 获取本类所有 ‘协议‘ 的数组 236 | /** 用来获取动态保存在关联对象中的协议数组 |运行时的关联对象根据key动态取值| */ 237 | const char *ba_protocolListKey = "ba_protocolListKey"; 238 | 239 | + (NSArray *)ba_protocolList { 240 | NSArray *protocolList = objc_getAssociatedObject(self, ba_protocolListKey); 241 | if (protocolList != nil) 242 | { 243 | return protocolList; 244 | } 245 | 246 | unsigned int count = 0; 247 | Protocol * __unsafe_unretained *protocolLists = class_copyProtocolList([self class], &count); 248 | 249 | NSMutableArray *arrayM = [NSMutableArray array]; 250 | for (unsigned int i = 0; i < count; i++) { 251 | // 获取 协议名 252 | Protocol *protocol = protocolLists[i]; 253 | const char *protocolName_C = protocol_getName(protocol); 254 | NSString *protocolName_OC = [NSString stringWithUTF8String:protocolName_C]; 255 | 256 | // 将 协议名 添加到数组 257 | [arrayM addObject:protocolName_OC]; 258 | } 259 | 260 | // 释放数组 261 | free(protocolLists); 262 | // 将保存 协议的数组动态添加到 关联对象 263 | objc_setAssociatedObject(self, ba_protocolListKey, arrayM, OBJC_ASSOCIATION_COPY_NONATOMIC); 264 | 265 | return objc_getAssociatedObject(self, ba_protocolListKey); 266 | } 267 | 268 | @end 269 | -------------------------------------------------------------------------------- /BAContact/BAAlertController/UIAlertController+BAKit.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | #import 61 | 62 | #if TARGET_OS_IOS 63 | typedef void (^UIAlertControllerPopoverPresentationControllerBlock) (UIPopoverPresentationController * __nonnull popover); 64 | #endif 65 | 66 | /** 67 | 按钮点击事件 block 68 | 69 | @param alertController alertController 70 | @param action UIAlertAction 71 | @param buttonIndex buttonIndex 72 | */ 73 | typedef void (^BAKit_AlertControllerButtonActionBlock) (UIAlertController * __nonnull alertController, UIAlertAction * __nonnull action, NSInteger buttonIndex); 74 | 75 | /** 76 | textField 配置信息 block 77 | 78 | @param textField textField 79 | @param index index 80 | */ 81 | typedef void (^BAKit_AlertControllerTextFieldConfigurationActionBlock)(UITextField * _Nullable textField, NSInteger index); 82 | 83 | @interface UIAlertController (BAKit) 84 | 85 | /** 86 | 快速创建一个系统 普通 UIAlertController-Alert 87 | 88 | @param viewController 显示的VC 89 | @param title title 90 | @param message message 91 | @param buttonTitleArray 按钮数组 92 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 93 | @param block block 94 | @return UIAlertController-Alert 95 | */ 96 | + (nonnull instancetype)ba_alertShowInViewController:(nonnull UIViewController *)viewController 97 | title:(nullable NSString *)title 98 | message:(nullable NSString *)message 99 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 100 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 101 | block:(nullable BAKit_AlertControllerButtonActionBlock)block; 102 | 103 | /** 104 | 快速创建一个系统 普通 带 textField 的 UIAlertController-Alert 105 | 106 | @param viewController 显示的VC 107 | @param title title 108 | @param message message 109 | @param buttonTitleArray 按钮数组 110 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 111 | @param buttonEnabledNoWithTitleArray 初始化的时候按钮为 EnabledNo 状态 的 title 数组 112 | @param textFieldPlaceholderArray textFieldPlaceholderArray 需要添加的 textField placeholder 数组 113 | @param textFieldConfigurationActionBlock textField 配置信息 block 114 | @param block block 115 | @return 普通 带 textField 的 UIAlertController-Alert 116 | */ 117 | + (nonnull instancetype)ba_alertTextFieldShowInViewController:(nonnull UIViewController *)viewController 118 | title:(nullable NSString *)title 119 | message:(nullable NSString *)message 120 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 121 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 122 | buttonEnabledNoWithTitleArray:(NSArray *_Nullable)buttonEnabledNoWithTitleArray 123 | textFieldPlaceholderArray:(NSArray *_Nullable)textFieldPlaceholderArray 124 | textFieldConfigurationActionBlock:(nullable BAKit_AlertControllerTextFieldConfigurationActionBlock)textFieldConfigurationActionBlock 125 | block:(nullable BAKit_AlertControllerButtonActionBlock)block; 126 | 127 | /** 128 | 快速创建一个系统 attributedTitle UIAlertController-Alert 129 | 130 | @param viewController 显示的VC 131 | @param attributedTitle attributedTitle 132 | @param attributedMessage attributedMessage 133 | @param buttonTitleArray 按钮数组 134 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 135 | @param block block 136 | @return UIAlertController-Alert 137 | */ 138 | + (nonnull instancetype)ba_alertAttributedShowInViewController:(nonnull UIViewController *)viewController 139 | attributedTitle:(nullable NSMutableAttributedString *)attributedTitle 140 | attributedMessage:(nullable NSMutableAttributedString *)attributedMessage 141 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 142 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 143 | block:(nullable BAKit_AlertControllerButtonActionBlock)block; 144 | 145 | 146 | /** 147 | 快速创建一个系统 普通 UIAlertController-ActionSheet 148 | 149 | @param viewController 显示的VC 150 | @param title title 151 | @param message message 152 | @param buttonTitleArray 按钮数组 153 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 154 | @param popoverPresentationControllerBlock popoverPresentationControllerBlock description 155 | @param block block 156 | @return UIAlertController-ActionSheet 157 | */ 158 | + (nonnull instancetype)ba_actionSheetShowInViewController:(nonnull UIViewController *)viewController 159 | title:(nullable NSString *)title 160 | message:(nullable NSString *)message 161 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 162 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 163 | #if TARGET_OS_IOS 164 | popoverPresentationControllerBlock:(nullable UIAlertControllerPopoverPresentationControllerBlock)popoverPresentationControllerBlock 165 | #endif 166 | block:(nullable BAKit_AlertControllerButtonActionBlock)block; 167 | 168 | /** 169 | 快速创建一个系统 attributedTitle UIAlertController-ActionSheet 170 | 171 | @param viewController 显示的VC 172 | @param attributedTitle attributedTitle 173 | @param attributedMessage attributedMessage 174 | @param buttonTitleArray 按钮数组 175 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 176 | @param popoverPresentationControllerBlock popoverPresentationControllerBlock description 177 | @param block block 178 | @return UIAlertController-ActionSheet 179 | */ 180 | + (nonnull instancetype)ba_actionSheetAttributedShowInViewController:(nonnull UIViewController *)viewController 181 | attributedTitle:(nullable NSMutableAttributedString *)attributedTitle 182 | attributedMessage:(nullable NSMutableAttributedString *)attributedMessage 183 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 184 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 185 | #if TARGET_OS_IOS 186 | popoverPresentationControllerBlock:(nullable UIAlertControllerPopoverPresentationControllerBlock)popoverPresentationControllerBlock 187 | #endif 188 | block:(nullable BAKit_AlertControllerButtonActionBlock)block; 189 | 190 | @end 191 | -------------------------------------------------------------------------------- /BAContact/BAAlertController/UIAlertController+BAKit.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // BAAlertController.h 4 | // BAAlertController 5 | // 6 | // Created by boai on 2017/6/5. 7 | // Copyright © 2017年 boai. All rights reserved. 8 | // 9 | 10 | #import "UIAlertController+BAKit.h" 11 | #import 12 | #import "NSObject+BARunTime.h" 13 | 14 | #import "BAAlertController.h" 15 | 16 | @interface UIViewController (BAAlertController) 17 | 18 | - (UIViewController *)ba_currentViewController; 19 | 20 | @end 21 | 22 | @implementation UIViewController (BAAlertController) 23 | 24 | - (UIViewController *)ba_currentViewController 25 | { 26 | UIViewController *topVC = self; 27 | 28 | UIViewController *above; 29 | while ((above = topVC.presentedViewController)) { 30 | topVC = above; 31 | } 32 | 33 | return topVC; 34 | } 35 | 36 | @end 37 | 38 | @implementation UIAlertController (BAKit) 39 | 40 | 41 | /** 42 | 快速创建一个系统 普通 UIAlertController-Alert 43 | 44 | @param viewController 显示的VC 45 | @param title title 46 | @param message message 47 | @param buttonTitleArray 按钮数组 48 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 49 | @param block block 50 | @return UIAlertController-Alert 51 | */ 52 | + (nonnull instancetype)ba_alertShowInViewController:(nonnull UIViewController *)viewController 53 | title:(nullable NSString *)title 54 | message:(nullable NSString *)message 55 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 56 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 57 | block:(nullable BAKit_AlertControllerButtonActionBlock)block 58 | { 59 | return [self ba_alertControllerShowInViewController:viewController 60 | title:title 61 | attributedTitle:nil 62 | message:message 63 | attributedMessage:nil 64 | preferredStyle:UIAlertControllerStyleAlert 65 | buttonTitleArray:buttonTitleArray 66 | buttonTitleColorArray:buttonTitleColorArray 67 | buttonEnabledNoWithTitleArray:nil 68 | textFieldPlaceholderArray:nil 69 | textFieldConfigurationActionBlock:nil 70 | #if TARGET_OS_IOS 71 | popoverPresentationControllerBlock:nil 72 | #endif 73 | block:block]; 74 | } 75 | 76 | /** 77 | 快速创建一个系统 普通 带 textField 的 UIAlertController-Alert 78 | 79 | @param viewController 显示的VC 80 | @param title title 81 | @param message message 82 | @param buttonTitleArray 按钮数组 83 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 84 | @param buttonEnabledNoWithTitleArray 初始化的时候按钮为 EnabledNo 状态 的 title 数组 85 | @param textFieldPlaceholderArray textFieldPlaceholderArray 需要添加的 textField placeholder 数组 86 | @param textFieldConfigurationActionBlock textField 配置信息 block 87 | @param block block 88 | @return 普通 带 textField 的 UIAlertController-Alert 89 | */ 90 | + (nonnull instancetype)ba_alertTextFieldShowInViewController:(nonnull UIViewController *)viewController 91 | title:(nullable NSString *)title 92 | message:(nullable NSString *)message 93 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 94 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 95 | buttonEnabledNoWithTitleArray:(NSArray *_Nullable)buttonEnabledNoWithTitleArray 96 | textFieldPlaceholderArray:(NSArray *_Nullable)textFieldPlaceholderArray 97 | textFieldConfigurationActionBlock:(nullable BAKit_AlertControllerTextFieldConfigurationActionBlock)textFieldConfigurationActionBlock 98 | block:(nullable BAKit_AlertControllerButtonActionBlock)block 99 | { 100 | return [self ba_alertControllerShowInViewController:viewController 101 | title:title 102 | attributedTitle:nil 103 | message:message 104 | attributedMessage:nil 105 | preferredStyle:UIAlertControllerStyleAlert 106 | buttonTitleArray:buttonTitleArray 107 | buttonTitleColorArray:buttonTitleColorArray 108 | buttonEnabledNoWithTitleArray:buttonEnabledNoWithTitleArray 109 | textFieldPlaceholderArray:textFieldPlaceholderArray 110 | textFieldConfigurationActionBlock:textFieldConfigurationActionBlock 111 | #if TARGET_OS_IOS 112 | popoverPresentationControllerBlock:nil 113 | #endif 114 | block:block]; 115 | } 116 | 117 | /** 118 | 快速创建一个系统 attributedTitle UIAlertController-Alert 119 | 120 | @param viewController 显示的VC 121 | @param attributedTitle attributedTitle 122 | @param attributedMessage attributedMessage 123 | @param buttonTitleArray 按钮数组 124 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 125 | @param block block 126 | @return UIAlertController-Alert 127 | */ 128 | + (nonnull instancetype)ba_alertAttributedShowInViewController:(nonnull UIViewController *)viewController 129 | attributedTitle:(nullable NSMutableAttributedString *)attributedTitle 130 | attributedMessage:(nullable NSMutableAttributedString *)attributedMessage 131 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 132 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 133 | block:(nullable BAKit_AlertControllerButtonActionBlock)block 134 | { 135 | return [self ba_alertControllerShowInViewController:viewController 136 | title:nil 137 | attributedTitle:attributedTitle 138 | message:nil 139 | attributedMessage:attributedMessage 140 | preferredStyle:UIAlertControllerStyleAlert 141 | buttonTitleArray:buttonTitleArray 142 | buttonTitleColorArray:buttonTitleColorArray 143 | buttonEnabledNoWithTitleArray:nil 144 | textFieldPlaceholderArray:nil 145 | textFieldConfigurationActionBlock:nil 146 | #if TARGET_OS_IOS 147 | popoverPresentationControllerBlock:nil 148 | #endif 149 | block:block]; 150 | } 151 | 152 | 153 | /** 154 | 快速创建一个系统 普通 UIAlertController-ActionSheet 155 | 156 | @param viewController 显示的VC 157 | @param title title 158 | @param message message 159 | @param buttonTitleArray 按钮数组 160 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 161 | @param popoverPresentationControllerBlock popoverPresentationControllerBlock description 162 | @param block block 163 | @return UIAlertController-ActionSheet 164 | */ 165 | + (nonnull instancetype)ba_actionSheetShowInViewController:(nonnull UIViewController *)viewController 166 | title:(nullable NSString *)title 167 | message:(nullable NSString *)message 168 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 169 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 170 | #if TARGET_OS_IOS 171 | popoverPresentationControllerBlock:(nullable UIAlertControllerPopoverPresentationControllerBlock)popoverPresentationControllerBlock 172 | #endif 173 | block:(nullable BAKit_AlertControllerButtonActionBlock)block 174 | { 175 | return [self ba_alertControllerShowInViewController:viewController 176 | title:title 177 | attributedTitle:nil 178 | message:message 179 | attributedMessage:nil 180 | preferredStyle:UIAlertControllerStyleActionSheet 181 | buttonTitleArray:buttonTitleArray 182 | buttonTitleColorArray:buttonTitleColorArray 183 | buttonEnabledNoWithTitleArray:nil 184 | textFieldPlaceholderArray:nil 185 | textFieldConfigurationActionBlock:nil 186 | #if TARGET_OS_IOS 187 | popoverPresentationControllerBlock:popoverPresentationControllerBlock 188 | #endif 189 | block:block]; 190 | } 191 | 192 | /** 193 | 快速创建一个系统 attributedTitle UIAlertController-ActionSheet 194 | 195 | @param viewController 显示的VC 196 | @param attributedTitle attributedTitle 197 | @param attributedMessage attributedMessage 198 | @param buttonTitleArray 按钮数组 199 | @param buttonTitleColorArray 按钮颜色数组,默认:系统蓝色,如果颜色数组个数小于title数组个数,则全部为默认蓝色 200 | @param popoverPresentationControllerBlock popoverPresentationControllerBlock description 201 | @param block block 202 | @return UIAlertController-ActionSheet 203 | */ 204 | + (nonnull instancetype)ba_actionSheetAttributedShowInViewController:(nonnull UIViewController *)viewController 205 | attributedTitle:(nullable NSMutableAttributedString *)attributedTitle 206 | attributedMessage:(nullable NSMutableAttributedString *)attributedMessage 207 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 208 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 209 | #if TARGET_OS_IOS 210 | popoverPresentationControllerBlock:(nullable UIAlertControllerPopoverPresentationControllerBlock)popoverPresentationControllerBlock 211 | #endif 212 | block:(nullable BAKit_AlertControllerButtonActionBlock)block 213 | { 214 | return [self ba_alertControllerShowInViewController:viewController 215 | title:nil 216 | attributedTitle:attributedTitle 217 | message:nil 218 | attributedMessage:attributedMessage 219 | preferredStyle:UIAlertControllerStyleActionSheet 220 | buttonTitleArray:buttonTitleArray 221 | buttonTitleColorArray:buttonTitleColorArray 222 | buttonEnabledNoWithTitleArray:nil 223 | textFieldPlaceholderArray:nil 224 | textFieldConfigurationActionBlock:nil 225 | #if TARGET_OS_IOS 226 | popoverPresentationControllerBlock:popoverPresentationControllerBlock 227 | #endif 228 | block:block]; 229 | } 230 | 231 | 232 | + (instancetype)ba_alertControllerShowInViewController:(UIViewController *)viewController 233 | title:(NSString *)title 234 | attributedTitle:(nullable NSMutableAttributedString *)attributedTitle 235 | message:(NSString *)message 236 | attributedMessage:(nullable NSMutableAttributedString *)attributedMessage 237 | preferredStyle:(UIAlertControllerStyle)preferredStyle 238 | buttonTitleArray:(nullable NSArray *)buttonTitleArray 239 | buttonTitleColorArray:(nullable NSArray *)buttonTitleColorArray 240 | buttonEnabledNoWithTitleArray:(NSArray *_Nullable)buttonEnabledNoWithTitleArray 241 | textFieldPlaceholderArray:(NSArray *_Nullable)textFieldPlaceholderArray 242 | textFieldConfigurationActionBlock:(nullable BAKit_AlertControllerTextFieldConfigurationActionBlock)textFieldConfigurationActionBlock 243 | #if TARGET_OS_IOS 244 | popoverPresentationControllerBlock:(void(^)(UIPopoverPresentationController *popover))popoverPresentationControllerBlock 245 | #endif 246 | block:(BAKit_AlertControllerButtonActionBlock)block 247 | { 248 | UIAlertController *strongController = [self alertControllerWithTitle:title 249 | message:message 250 | preferredStyle:preferredStyle]; 251 | 252 | __weak UIAlertController *alertController = strongController; 253 | 254 | if (buttonTitleArray) 255 | { 256 | for (NSUInteger i = 0; i < buttonTitleArray.count; i++) 257 | { 258 | NSString *buttonTitle = buttonTitleArray[i]; 259 | 260 | UIAlertAction *action = [UIAlertAction actionWithTitle:buttonTitle 261 | style:UIAlertActionStyleDefault 262 | handler:^(UIAlertAction *action){ 263 | if (block) 264 | { 265 | block(alertController, action, i); 266 | } 267 | }]; 268 | [alertController addAction:action]; 269 | 270 | for (NSInteger j = 0; j < buttonEnabledNoWithTitleArray.count; j ++) 271 | { 272 | if ([buttonEnabledNoWithTitleArray[j] isEqualToString:buttonTitle]) 273 | { 274 | action.enabled = NO; 275 | } 276 | } 277 | 278 | if (!buttonTitleColorArray || buttonTitleColorArray.count == 0 || 279 | buttonTitleColorArray.count < buttonTitleArray.count) 280 | { 281 | NSMutableArray *mutArr = [NSMutableArray array]; 282 | for (NSInteger i = 0; i < buttonTitleArray.count; i ++) 283 | { 284 | [mutArr addObject:[UIColor blueColor]]; 285 | } 286 | buttonTitleColorArray = [mutArr mutableCopy]; 287 | } 288 | if (buttonTitleColorArray) 289 | { 290 | [strongController setAlertWithAlert:strongController 291 | mutableAttributedTitle:attributedTitle 292 | mutableAttributedMessage:attributedMessage 293 | Action:action 294 | buttonTitleColor:buttonTitleColorArray[i]]; 295 | } 296 | } 297 | } 298 | if (textFieldPlaceholderArray) 299 | { 300 | for (NSInteger i = 0; i < textFieldPlaceholderArray.count; i++) 301 | { 302 | [alertController addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) { 303 | 304 | textField.placeholder = textFieldPlaceholderArray[i]; 305 | if (textFieldConfigurationActionBlock) 306 | { 307 | textFieldConfigurationActionBlock(textField, i); 308 | } 309 | }]; 310 | } 311 | } 312 | 313 | if (preferredStyle == UIAlertControllerStyleActionSheet) 314 | { 315 | UIAlertAction *action = [UIAlertAction actionWithTitle:@"取 消" 316 | style:UIAlertActionStyleCancel 317 | handler:nil]; 318 | [alertController addAction:action]; 319 | } 320 | 321 | #if TARGET_OS_IOS 322 | if (popoverPresentationControllerBlock) 323 | { 324 | popoverPresentationControllerBlock(alertController.popoverPresentationController); 325 | } 326 | #endif 327 | 328 | [viewController.ba_currentViewController presentViewController:alertController animated:YES completion:nil]; 329 | 330 | return alertController; 331 | } 332 | 333 | #pragma mark - setter / getter 334 | 335 | - (void)setAlertWithAlert:(UIAlertController * __nonnull )alert 336 | mutableAttributedTitle:(NSMutableAttributedString *)mutableAttributedTitle 337 | mutableAttributedMessage:(nullable NSMutableAttributedString *)mutableAttributedMessage 338 | Action:(UIAlertAction * __nonnull )action 339 | buttonTitleColor:(UIColor *)buttonTitleColor 340 | { 341 | /*! 1、首先获得对应的属性 */ 342 | // NSArray *propertysListArray = [[UIAlertController class] ba_propertysList]; 343 | // NSLog(@"1、获取【UIAlertController】所有的属性名:%@", propertysListArray); 344 | 345 | /*! 2、获得成员变量 */ 346 | NSArray *ivarListArray = [[UIAlertAction class] ba_ivarList]; 347 | // NSLog(@"2、获取【UIAlertController】所有的成员变量:%@", ivarListArray); 348 | 349 | for (NSInteger i = 0; i < ivarListArray.count; i++) 350 | { 351 | NSString *ivarName = ivarListArray[i]; 352 | if ([ivarName isEqualToString:@"_titleTextColor"]) 353 | { 354 | [action setValue:buttonTitleColor forKey:@"titleTextColor"]; 355 | } 356 | } 357 | 358 | /*! 3、改变显示提示字体颜色 */ 359 | NSArray *propertysListArray2 = [[UIAlertController class] ba_ivarList]; 360 | // NSLog(@"3、获取【UIAlertController】所有的成员变量:%@", propertysListArray2); 361 | for (NSInteger i = 0; i < propertysListArray2.count; i++) 362 | { 363 | NSString *ivarName = propertysListArray2[i]; 364 | if ([ivarName isEqualToString:@"_attributedTitle"]) 365 | { 366 | [alert setValue:mutableAttributedTitle forKey:@"attributedTitle"]; 367 | } 368 | if ([ivarName isEqualToString:@"_attributedMessage"]) 369 | { 370 | [alert setValue:mutableAttributedMessage forKey:@"attributedMessage"]; 371 | } 372 | } 373 | } 374 | 375 | @end 376 | 377 | -------------------------------------------------------------------------------- /BAContact/BAContact/BAContact.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * 5 | * @brief BAKit 6 | * 7 | * @author 博爱 8 | * @copyright Copyright © 2016年 博爱. All rights reserved. 9 | * @version V1.0 10 | */ 11 | 12 | // _ooOoo_ 13 | // o8888888o 14 | // 88" . "88 15 | // (| -_- |) 16 | // O\ = /O 17 | // ____/`---'\____ 18 | // . ' \\| |// `. 19 | // / \\||| : |||// \ 20 | // / _||||| -:- |||||- \ 21 | // | | \\\ - /// | | 22 | // | \_| ''\---/'' | | 23 | // \ .-\__ `-` ___/-. / 24 | // ___`. .' /--.--\ `. . __ 25 | // ."" '< `.___\_<|>_/___.' >'"". 26 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 27 | // \ \ `-. \_ __\ /__ _/ .-` / / 28 | // ======`-.____`-.___\_____/___.-`____.-'====== 29 | // `=---=' 30 | // 31 | // ............................................. 32 | // 佛祖镇楼 BUG辟易 33 | // 佛曰: 34 | // 一人 我编程累 累得只想把觉睡 35 | // 两眼 是辛酸泪 代码咋写都不对 36 | // 37 | // 重启是也不行 关机它也不灵 38 | // 我狂敲键盘怒砸鼠标 异常也不停 39 | // 40 | // 这循环它有点绕 注释也很微妙 41 | // 我看了半天稀里糊涂马隔壁我草 42 | // 43 | // 加断点 再抵坝 堆栈瞬间就爆炸 44 | // 日志输出如雨下 看到异常就害怕 45 | // 46 | // 调试一夜没人陪 心想这锅该归谁 47 | // 回想当初心后悔 不该重构这地雷 48 | // 49 | // 翻日志 看半天 博客看了几百篇 50 | // 闪退还是没复现 低头又点一根烟 51 | // 52 | // 加着班我心烦乱 烂摊子我不想干 53 | // 离职损失就几万 一拍桌子把工作换 54 | // 55 | // 离职 我不再忙 在家 我守空房 56 | // 我闲得无聊掏出电脑 代码又写几行 57 | 58 | /* 59 | 60 | ********************************************************************************* 61 | * 62 | * 在使用 BAKit 的过程中如果出现 bug 请及时以以下任意一种方式联系我,我会及时修复 bug 63 | * 64 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 65 | * 微博 : 博爱1616 66 | * Email : 137361770@qq.com 67 | * GitHub : https://github.com/boai 68 | * BAHome : https://github.com/BAHome 69 | * 博客 : http://boaihome.com 70 | 71 | ********************************************************************************* 72 | 73 | */ 74 | 75 | #ifndef BAContact_h 76 | #define BAContact_h 77 | 78 | 79 | // 系统自带的中英文混合排序 80 | #import "BAKit_LocalizedIndexedCollation.h" 81 | 82 | #import "BAKit_ConfigurationDefine.h" 83 | #import "UIImage+BAContact.h" 84 | 85 | /*! 86 | ********************************************************************************* 87 | ************************************ 更新说明 ************************************ 88 | ********************************************************************************* 89 | 90 | 欢迎使用 BAHome 系列开源代码 ! 91 | 如有更多需求,请前往:https://github.com/BAHome 92 | 93 | 项目源码地址: 94 | OC 版 :https://github.com/BAHome/BAContact 95 | 96 | 最新更新时间:2017-08-05 【倒叙】
97 | 最新Version:【Version:1.0.0】
98 | 更新内容:
99 | 1.0.0.1、通讯录,最简单的中英文混合排序封装,微信通讯录 demo!
100 | 1.0.0.2、获取系统通讯录内容,然后添加到自定义通讯录
101 | 1.0.0.3、UISearchController 的详细使用方法
102 | */ 103 | 104 | #endif /* BAContact_h */ 105 | -------------------------------------------------------------------------------- /BAContact/BAContact/BAKit_ConfigurationDefine.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * 5 | * @brief BAKit 6 | * 7 | * @author 博爱 8 | * @copyright Copyright © 2016年 博爱. All rights reserved. 9 | * @version V1.0 10 | */ 11 | 12 | // _ooOoo_ 13 | // o8888888o 14 | // 88" . "88 15 | // (| -_- |) 16 | // O\ = /O 17 | // ____/`---'\____ 18 | // . ' \\| |// `. 19 | // / \\||| : |||// \ 20 | // / _||||| -:- |||||- \ 21 | // | | \\\ - /// | | 22 | // | \_| ''\---/'' | | 23 | // \ .-\__ `-` ___/-. / 24 | // ___`. .' /--.--\ `. . __ 25 | // ."" '< `.___\_<|>_/___.' >'"". 26 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 27 | // \ \ `-. \_ __\ /__ _/ .-` / / 28 | // ======`-.____`-.___\_____/___.-`____.-'====== 29 | // `=---=' 30 | // 31 | // ............................................. 32 | // 佛祖镇楼 BUG辟易 33 | // 佛曰: 34 | // 写字楼里写字间,写字间里程序员; 35 | // 程序人员写程序,又拿程序换酒钱。 36 | // 酒醒只在网上坐,酒醉还来网下眠; 37 | // 酒醉酒醒日复日,网上网下年复年。 38 | // 但愿老死电脑间,不愿鞠躬老板前; 39 | // 奔驰宝马贵者趣,公交自行程序员。 40 | // 别人笑我忒疯癫,我笑自己命太贱; 41 | // 不见满街漂亮妹,哪个归得程序员? 42 | 43 | /* 44 | 45 | ********************************************************************************* 46 | * 47 | * 在使用 BAKit 的过程中如果出现 bug 请及时以以下任意一种方式联系我,我会及时修复 bug 48 | * 49 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 50 | * 微博 : 博爱1616 51 | * Email : 137361770@qq.com 52 | * GitHub : https://github.com/boai 53 | * BAHome : https://github.com/BAHome 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ 59 | 60 | 61 | #ifndef BAKit_ConfigurationDefine_h 62 | #define BAKit_ConfigurationDefine_h 63 | 64 | 65 | #ifndef __OPTIMIZE__ 66 | #define NSLog(...) NSLog(__VA_ARGS__) 67 | #else 68 | #define NSLog(...){} 69 | #endif 70 | 71 | #pragma mark - weak / strong 72 | #define BAKit_WeakSelf @BAKit_Weakify(self); 73 | #define BAKit_StrongSelf @BAKit_Strongify(self); 74 | 75 | /*! 76 | * 强弱引用转换,用于解决代码块(block)与强引用self之间的循环引用问题 77 | * 调用方式: `@BAKit_Weakify`实现弱引用转换,`@BAKit_Strongify`实现强引用转换 78 | * 79 | * 示例: 80 | * @BAKit_Weakify 81 | * [obj block:^{ 82 | * @strongify_self 83 | * self.property = something; 84 | * }]; 85 | */ 86 | #ifndef BAKit_Weakify 87 | #if DEBUG 88 | #if __has_feature(objc_arc) 89 | #define BAKit_Weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object; 90 | #else 91 | #define BAKit_Weakify(object) autoreleasepool{} __block __typeof__(object) block##_##object = object; 92 | #endif 93 | #else 94 | #if __has_feature(objc_arc) 95 | #define BAKit_Weakify(object) try{} @finally{} {} __weak __typeof__(object) weak##_##object = object; 96 | #else 97 | #define BAKit_Weakify(object) try{} @finally{} {} __block __typeof__(object) block##_##object = object; 98 | #endif 99 | #endif 100 | #endif 101 | 102 | /*! 103 | * 强弱引用转换,用于解决代码块(block)与强引用对象之间的循环引用问题 104 | * 调用方式: `@BAKit_Weakify(object)`实现弱引用转换,`@BAKit_Strongify(object)`实现强引用转换 105 | * 106 | * 示例: 107 | * @BAKit_Weakify(object) 108 | * [obj block:^{ 109 | * @BAKit_Strongify(object) 110 | * strong_object = something; 111 | * }]; 112 | */ 113 | #ifndef BAKit_Strongify 114 | #if DEBUG 115 | #if __has_feature(objc_arc) 116 | #define BAKit_Strongify(object) autoreleasepool{} __typeof__(object) object = weak##_##object; 117 | #else 118 | #define BAKit_Strongify(object) autoreleasepool{} __typeof__(object) object = block##_##object; 119 | #endif 120 | #else 121 | #if __has_feature(objc_arc) 122 | #define BAKit_Strongify(object) try{} @finally{} __typeof__(object) object = weak##_##object; 123 | #else 124 | #define BAKit_Strongify(object) try{} @finally{} __typeof__(object) object = block##_##object; 125 | #endif 126 | #endif 127 | #endif 128 | 129 | /*! 获取sharedApplication */ 130 | #define BAKit_SharedApplication [UIApplication sharedApplication] 131 | 132 | // 操作系统版本号 133 | #define BAKit_IOS_VERSION ([[[UIDevice currentDevice] systemVersion] floatValue]) 134 | 135 | /*! 主线程同步队列 */ 136 | #define dispatch_main_sync_safe(block)\ 137 | if ([NSThread isMainThread]) {\ 138 | block();\ 139 | } else {\ 140 | dispatch_sync(dispatch_get_main_queue(), block);\ 141 | } 142 | /*! 主线程异步队列 */ 143 | #define dispatch_main_async_safe(block)\ 144 | if ([NSThread isMainThread]) {\ 145 | block();\ 146 | } else {\ 147 | dispatch_async(dispatch_get_main_queue(), block);\ 148 | } 149 | 150 | 151 | #pragma mark - runtime 152 | #import 153 | /*! runtime set */ 154 | #define BAKit_Objc_setObj(key, value) objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_RETAIN_NONATOMIC) 155 | 156 | /*! runtime setCopy */ 157 | #define BAKit_Objc_setObjCOPY(key, value) objc_setAssociatedObject(self, key, value, OBJC_ASSOCIATION_COPY) 158 | 159 | /*! runtime get */ 160 | #define BAKit_Objc_getObj objc_getAssociatedObject(self, _cmd) 161 | 162 | /*! runtime exchangeMethod */ 163 | #define BAKit_Objc_exchangeMethodAToB(originalSelector,swizzledSelector) { \ 164 | Method originalMethod = class_getInstanceMethod(self, originalSelector); \ 165 | Method swizzledMethod = class_getInstanceMethod(self, swizzledSelector); \ 166 | if (class_addMethod(self, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) { \ 167 | class_replaceMethod(self, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); \ 168 | } else { \ 169 | method_exchangeImplementations(originalMethod, swizzledMethod); \ 170 | } \ 171 | } 172 | 173 | #pragma mark - 简单警告框 174 | /*! view 用 BAKit_ShowAlertWithMsg */ 175 | #define BAKit_ShowAlertWithMsg(msg) [[[UIAlertView alloc] initWithTitle:@"温馨提示" message:(msg) delegate:nil cancelButtonTitle:@"确 定" otherButtonTitles:nil] show]; 176 | /*! VC 用 BAKit_ShowAlertWithMsg */ 177 | #define BAKit_ShowAlertWithMsg_ios8(msg) UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"温馨提示" message:msg preferredStyle:UIAlertControllerStyleAlert];\ 178 | UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确 定" style:UIAlertActionStyleDefault handler:nil];\ 179 | [alert addAction:sureAction];\ 180 | [self presentViewController:alert animated:YES completion:nil]; 181 | 182 | #pragma mark - color 183 | CG_INLINE UIColor * 184 | BAKit_Color_RGBA_pod(u_char r,u_char g, u_char b, u_char a) { 185 | return [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]; 186 | } 187 | 188 | CG_INLINE UIColor * 189 | BAKit_Color_RGB_pod(u_char r,u_char g, u_char b) { 190 | return BAKit_Color_RGBA_pod(r, g, b, 1.0); 191 | } 192 | 193 | CG_INLINE UIColor * 194 | BAKit_Color_RGBValue_pod(UInt32 rgbValue){ 195 | return [UIColor colorWithRed:((rgbValue & 0xff0000) >> 16) / 255.0f 196 | green:((rgbValue & 0xff00) >> 8) / 255.0f 197 | blue:(rgbValue & 0xff) / 255.0f 198 | alpha:1.0f]; 199 | } 200 | 201 | CG_INLINE UIColor * 202 | BAKit_Color_RGBAValue_pod(UInt32 rgbaValue){ 203 | return [UIColor colorWithRed:((rgbaValue & 0xff000000) >> 24) / 255.0f 204 | green:((rgbaValue & 0xff0000) >> 16) / 255.0f 205 | blue:((rgbaValue & 0xff00) >> 8) / 255.0f 206 | alpha:(rgbaValue & 0xff) / 255.0f]; 207 | } 208 | 209 | CG_INLINE UIColor * 210 | BAKit_Color_RandomRGB_pod(){ 211 | return BAKit_Color_RGBValue_pod(arc4random_uniform(0xffffff)); 212 | } 213 | 214 | CG_INLINE UIColor * 215 | BAKit_Color_RandomRGBA_pod(){ 216 | return BAKit_Color_RGBAValue_pod(arc4random_uniform(0xffffffff)); 217 | } 218 | 219 | #define BAKit_Color_Translucent_pod [UIColor colorWithRed:0.3f green:0.3f blue:0.3f alpha:0.5f] 220 | #define BAKit_Color_White_pod [UIColor whiteColor] 221 | #define BAKit_Color_Clear_pod [UIColor clearColor] 222 | #define BAKit_Color_Black_pod [UIColor blackColor] 223 | #define BAKit_Color_White_pod [UIColor whiteColor] 224 | #define BAKit_Color_Red_pod [UIColor redColor] 225 | #define BAKit_Color_Green_pod [UIColor greenColor] 226 | #define BAKit_Color_Orange_pod [UIColor orangeColor] 227 | #define BAKit_Color_Yellow_pod [UIColor yellowColor] 228 | 229 | 230 | /*! 灰色 */ 231 | #define BAKit_Color_Gray_1_pod BAKit_Color_RGB_pod(53, 60, 70) 232 | #define BAKit_Color_Gray_2_pod BAKit_Color_RGB_pod(73, 80, 90) 233 | #define BAKit_Color_Gray_3_pod BAKit_Color_RGB_pod(93, 100, 110) 234 | #define BAKit_Color_Gray_4_pod BAKit_Color_RGB_pod(113, 120, 130) 235 | #define BAKit_Color_Gray_5_pod BAKit_Color_RGB_pod(133, 140, 150) 236 | #define BAKit_Color_Gray_6_pod BAKit_Color_RGB_pod(153, 160, 170) 237 | #define BAKit_Color_Gray_7_pod BAKit_Color_RGB_pod(173, 180, 190) 238 | #define BAKit_Color_Gray_8_pod BAKit_Color_RGB_pod(196, 200, 208) 239 | #define BAKit_Color_Gray_9_pod BAKit_Color_RGB_pod(216, 220, 228) 240 | #define BAKit_Color_Gray_10_pod BAKit_Color_RGB_pod(240, 240, 240) 241 | #define BAKit_Color_Gray_11_pod BAKit_Color_RGB_pod(248, 248, 248) 242 | 243 | #pragma mark - Margin 244 | #define BAKit_Margin_1_pod BAKit_Flat_pod(1) 245 | #define BAKit_Margin_2_pod BAKit_Flat_pod(2) 246 | #define BAKit_Margin_5_pod BAKit_Flat_pod(5) 247 | #define BAKit_Margin_10_pod BAKit_Flat_pod(10) 248 | #define BAKit_Margin_15_pod BAKit_Flat_pod(15) 249 | #define BAKit_Margin_20_pod BAKit_Flat_pod(20) 250 | #define BAKit_Margin_25_pod BAKit_Flat_pod(25) 251 | #define BAKit_Margin_30_pod BAKit_Flat_pod(30) 252 | #define BAKit_Margin_35_pod BAKit_Flat_pod(35) 253 | #define BAKit_Margin_40_pod BAKit_Flat_pod(40) 254 | #define BAKit_Margin_44_pod BAKit_Flat_pod(44) 255 | #define BAKit_Margin_50_pod BAKit_Flat_pod(50) 256 | #define BAKit_Margin_100_pod BAKit_Flat_pod(100) 257 | #define BAKit_Margin_150_pod BAKit_Flat_pod(150) 258 | 259 | 260 | #define BAKit_ImageName(imageName) [UIImage imageNamed:imageName] 261 | 262 | #pragma mark - NotiCenter other 263 | #define BAKit_NotiCenter [NSNotificationCenter defaultCenter] 264 | 265 | #define BAKit_NSUserDefaults [NSUserDefaults standardUserDefaults] 266 | 267 | /*! 获取sharedApplication */ 268 | #define BAKit_SharedApplication [UIApplication sharedApplication] 269 | 270 | /*! 用safari打开URL */ 271 | #define BAKit_OpenUrl(urlStr) [BAKit_SharedApplication openURL:[NSURL URLWithString:urlStr]] 272 | 273 | /*! 复制文字内容 */ 274 | #define BAKit_CopyContent(content) [[UIPasteboard generalPasteboard] setString:content] 275 | 276 | 277 | /*! 278 | * 获取屏幕宽度和高度 279 | */ 280 | #define BAKit_SCREEN_WIDTH ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.width : [[UIScreen mainScreen] bounds].size.height) 281 | 282 | #define BAKit_SCREEN_HEIGHT ((([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) ? [[UIScreen mainScreen] bounds].size.height : [[UIScreen mainScreen] bounds].size.width) 283 | 284 | #define BAKit_BaseScreenWidth 320.0f 285 | #define BAKit_BaseScreenHeight 568.0f 286 | 287 | /*! 屏幕适配(5S标准屏幕:320 * 568) */ 288 | // iPhone 7 屏幕:375 * 667 289 | //376/320 = 290 | //667/568 = 291 | #define BAKit_ScaleXAndWidth BAKit_SCREEN_WIDTH/BAKit_BaseScreenWidth 292 | #define BAKit_ScaleYAndHeight BAKit_SCREEN_HEIGHT/BAKit_BaseScreenHeight 293 | 294 | #define BAKit_ScreenScale ([[UIScreen mainScreen] scale]) 295 | 296 | CG_INLINE BOOL 297 | BAKit_stringIsBlank_pod(NSString *string) { 298 | NSCharacterSet *blank = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 299 | for (NSInteger i = 0; i < string.length; ++i) { 300 | unichar c = [string characterAtIndex:i]; 301 | if (![blank characterIsMember:c]) { 302 | return NO; 303 | } 304 | } 305 | return YES; 306 | } 307 | 308 | /** 309 | * 基于指定的倍数,对传进来的 floatValue 进行像素取整。若指定倍数为0,则表示以当前设备的屏幕倍数为准。 310 | * 311 | * 例如传进来 “2.1”,在 2x 倍数下会返回 2.5(0.5pt 对应 1px),在 3x 倍数下会返回 2.333(0.333pt 对应 1px)。 312 | */ 313 | CG_INLINE CGFloat 314 | BAKit_FlatSpecificScale_pod(CGFloat floatValue, CGFloat scale) { 315 | scale = scale == 0 ? BAKit_ScreenScale : scale; 316 | CGFloat flattedValue = ceil(floatValue * scale) / scale; 317 | return flattedValue; 318 | } 319 | 320 | /** 321 | * 基于当前设备的屏幕倍数,对传进来的 floatValue 进行像素取整。 322 | * 323 | * 注意如果在 Core Graphic 绘图里使用时,要注意当前画布的倍数是否和设备屏幕倍数一致,若不一致,不可使用 flat() 函数,而应该用 flatSpecificScale 324 | */ 325 | CG_INLINE CGFloat 326 | BAKit_Flat_pod(CGFloat floatValue) { 327 | return BAKit_FlatSpecificScale_pod(floatValue, 0); 328 | } 329 | 330 | /// 将一个CGSize像素对齐 331 | CG_INLINE CGSize 332 | BAKit_CGSizeFlatted_pod(CGSize size) { 333 | return CGSizeMake(BAKit_Flat_pod(size.width), BAKit_Flat_pod(size.height)); 334 | } 335 | 336 | /// 创建一个像素对齐的CGRect 337 | CG_INLINE CGRect 338 | BAKit_CGRectFlatMake_pod(CGFloat x, CGFloat y, CGFloat width, CGFloat height) { 339 | return CGRectMake(BAKit_Flat_pod(x), BAKit_Flat_pod(y), BAKit_Flat_pod(width), BAKit_Flat_pod(height)); 340 | } 341 | 342 | /** 343 | 计算列数【根据 array.count、每行多少个 item,计算列数】 344 | 345 | @param array array 346 | @param rowCount 每行多少个 item 347 | @return 列数 348 | */ 349 | CG_INLINE NSInteger 350 | BAKit_getColumnCountWithArrayAndRowCount_pod(NSArray *array, NSInteger rowCount){ 351 | NSUInteger count = array.count; 352 | 353 | NSUInteger i = 0; 354 | if (count % rowCount == 0) 355 | { 356 | i = count / rowCount; 357 | } 358 | else 359 | { 360 | i = count / rowCount + 1; 361 | } 362 | return i; 363 | } 364 | 365 | CG_INLINE NSInteger 366 | BAKit_RandomNumber_pod(NSInteger i){ 367 | return arc4random() % i; 368 | } 369 | 370 | #endif /* BAKit_ConfigurationDefine_h */ 371 | -------------------------------------------------------------------------------- /BAContact/BAContact/BAKit_LocalizedIndexedCollation.h: -------------------------------------------------------------------------------- 1 | 2 | /*! 3 | * @header BAKit.h 4 | * BABaseProject 5 | * 6 | * @brief BAKit 7 | * 8 | * @author 博爱 9 | * @copyright Copyright © 2016年 博爱. All rights reserved. 10 | * @version V1.0 11 | */ 12 | 13 | // _ooOoo_ 14 | // o8888888o 15 | // 88" . "88 16 | // (| -_- |) 17 | // O\ = /O 18 | // ____/`---'\____ 19 | // . ' \\| |// `. 20 | // / \\||| : |||// \ 21 | // / _||||| -:- |||||- \ 22 | // | | \\\ - /// | | 23 | // | \_| ''\---/'' | | 24 | // \ .-\__ `-` ___/-. / 25 | // ___`. .' /--.--\ `. . __ 26 | // ."" '< `.___\_<|>_/___.' >'"". 27 | // | | : `- \`.;`\ _ /`;.`/ - ` : | | 28 | // \ \ `-. \_ __\ /__ _/ .-` / / 29 | // ======`-.____`-.___\_____/___.-`____.-'====== 30 | // `=---=' 31 | // 32 | // ............................................. 33 | // 佛祖镇楼 BUG辟易 34 | // 佛曰: 35 | // 写字楼里写字间,写字间里程序员; 36 | // 程序人员写程序,又拿程序换酒钱。 37 | // 酒醒只在网上坐,酒醉还来网下眠; 38 | // 酒醉酒醒日复日,网上网下年复年。 39 | // 但愿老死电脑间,不愿鞠躬老板前; 40 | // 奔驰宝马贵者趣,公交自行程序员。 41 | // 别人笑我忒疯癫,我笑自己命太贱; 42 | // 不见满街漂亮妹,哪个归得程序员? 43 | 44 | /* 45 | 46 | ********************************************************************************* 47 | * 48 | * 在使用BAKit的过程中如果出现bug请及时以以下任意一种方式联系我,我会及时修复bug 49 | * 50 | * QQ : 可以添加ios开发技术群 479663605 在这里找到我(博爱1616【137361770】) 51 | * 微博 : 博爱1616 52 | * Email : 137361770@qq.com 53 | * GitHub : https://github.com/boai 54 | * 博客 : http://boaihome.com 55 | 56 | ********************************************************************************* 57 | 58 | */ //按首字母或者汉字拼音首字母分组排序索引工具类 59 | 60 | #import 61 | #import 62 | 63 | /*! 索引 */ 64 | #define kBALocalizedIndexArrayKey @"kBALocalizedIndexArrayKey" 65 | /*! 排序后的分组,可以为 model */ 66 | #define kBALocalizedGroupArrayKey @"kBALocalizedGroupArrayKey" 67 | 68 | @interface BAKit_LocalizedIndexedCollation : NSObject 69 | 70 | /*! 71 | 对数组排序 72 | 73 | @param dataArray 需要排序的数组,可以为 model 74 | @param localizedNameSEL 数组中对象需要排序的属性,可以为 model.userName 75 | 76 | @return 排序后的索引及 groupArray 字典形式 kBALocalizedIndexArrayKey kBALocalizedGroupArrayKey 77 | */ 78 | + (NSDictionary *)ba_localizedWithDataArray:(NSMutableArray *)dataArray 79 | localizedNameSEL:(SEL)localizedNameSEL; 80 | 81 | @end 82 | -------------------------------------------------------------------------------- /BAContact/BAContact/BAKit_LocalizedIndexedCollation.m: -------------------------------------------------------------------------------- 1 | // 2 | // BAPropertyName.m 3 | // BAQMUIDemo 4 | // 5 | // Created by 博爱 on 2017/1/16. 6 | // Copyright © 2017年 boaihome. All rights reserved. 7 | // 8 | 9 | #import "BAKit_LocalizedIndexedCollation.h" 10 | 11 | @implementation BAKit_LocalizedIndexedCollation 12 | 13 | /*! 14 | 对数组排序 15 | 16 | @param dataArray 需要排序的数组,可以为 model 17 | @param localizedNameSEL 数组中对象需要排序的属性,可以为 model.userName 18 | 19 | @return 排序后的索引及 groupArray 字典形式 kBALocalizedIndexArrayKey kBALocalizedGroupArrayKey 20 | */ 21 | + (NSDictionary *)ba_localizedWithDataArray:(NSMutableArray *)dataArray 22 | localizedNameSEL:(SEL)localizedNameSEL 23 | { 24 | /*! 对数组重建索引,按照abcd字母顺序进行分组 */ 25 | UILocalizedIndexedCollation *indexCollation = [UILocalizedIndexedCollation currentCollation]; 26 | NSInteger index, sectionTitlesCount = [[indexCollation sectionTitles] count]; 27 | NSMutableArray *indexArray = [[NSMutableArray alloc] initWithArray:[indexCollation sectionTitles]]; 28 | 29 | /*! 临时数据,存放 section 对应的 userObjc 数组数据 */ 30 | NSMutableArray *newSectionsArray = [[NSMutableArray alloc] initWithCapacity:sectionTitlesCount]; 31 | 32 | /*! 设置sections数组初始化:元素包含userObjs数据的空数据 */ 33 | for (index = 0; index < sectionTitlesCount; index++) 34 | { 35 | NSMutableArray *array = [[NSMutableArray alloc] init]; 36 | [newSectionsArray addObject:array]; 37 | } 38 | 39 | /*! 分组 */ 40 | for (id object in dataArray) 41 | { 42 | /*! 根据timezone的localename,获得对应的的section number */ 43 | NSInteger sectionNumber = [indexCollation sectionForObject:object collationStringSelector:localizedNameSEL]; 44 | /*! 根据sectionNumber获取数组 */ 45 | NSMutableArray *sectionUserObjs = [newSectionsArray objectAtIndex:sectionNumber]; 46 | /*! 添加对象到对应的数组中 */ 47 | [sectionUserObjs addObject:object]; 48 | } 49 | 50 | /*! 获取空的数组的index */ 51 | NSMutableArray *willDeleteAry = [NSMutableArray new]; 52 | for (int i = 0; i < newSectionsArray.count; i ++) 53 | { 54 | NSArray *tempAry = newSectionsArray[i]; 55 | if (tempAry.count == 0) { 56 | [willDeleteAry addObject:[NSString stringWithFormat:@"%d",i]]; 57 | } 58 | } 59 | 60 | /*! 删除空的数组 */ 61 | for (NSInteger i = willDeleteAry.count; i > 0; i -- ) 62 | { 63 | NSInteger index = [willDeleteAry[i - 1] integerValue]; 64 | [newSectionsArray removeObjectAtIndex:index]; 65 | [indexArray removeObjectAtIndex:index]; 66 | } 67 | 68 | /*! 该字典中存放分组排序呢后的索引及数据 */ 69 | NSDictionary *dict = @{kBALocalizedGroupArrayKey : newSectionsArray, 70 | kBALocalizedIndexArrayKey : indexArray}; 71 | 72 | return dict; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /BAContact/BAContact/UIImage+BAContact.h: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+BAContact.h 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/3. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface UIImage (BAContact) 12 | 13 | /*! 14 | 获得新的圆形图片 15 | 16 | @param image 传入需要裁剪成圆形的图片 17 | @return 返回裁剪好的圆形图片 18 | */ 19 | + (UIImage *)ba_imageToRoundImageWithImage:(UIImage *)image; 20 | 21 | /*! 22 | * 传入图片,cell,imageSize,改变自定义大小的圆形系统 cell image 23 | * 24 | * @param cell cell 25 | * @param image image 可以自己切圆角:[UIImage ba_imageToRoundImageWithImage:UIImageMake(@"icon1.jpg")]; 26 | * @param imageSize 图像的 size 记得先切圆角再传 size 27 | * 28 | * @return 返回自定义大小的圆形系统 cell image 29 | */ 30 | + (UIImage *)ba_imageToChangeCellRoundImageViewSizeWithCell:(UITableViewCell *)cell 31 | image:(UIImage *)image 32 | imageSize:(CGSize)imageSize; 33 | 34 | @end 35 | 36 | @interface NSString (BAContact) 37 | 38 | /** 39 | 判断 string 是否为空 40 | 41 | @return YES:为空,NO:不为空 42 | */ 43 | - (BOOL)ba_stringIsBlank; 44 | 45 | /** 46 | 判断一个字符串里面是否包含另一个字符串 47 | 48 | @param string string 49 | @return YES/NO 50 | */ 51 | - (BOOL)ba_stringIncludesString:(NSString *)string; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /BAContact/BAContact/UIImage+BAContact.m: -------------------------------------------------------------------------------- 1 | // 2 | // UIImage+BAContact.m 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/3. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import "UIImage+BAContact.h" 10 | 11 | @implementation UIImage (BAContact) 12 | 13 | /*! 14 | 获得新的圆形图片 15 | 16 | @param image 传入需要裁剪成圆形的图片 17 | @return 返回裁剪好的圆形图片 18 | */ 19 | + (UIImage *)ba_imageToRoundImageWithImage:(UIImage *)image 20 | { 21 | if (!image)return nil; 22 | 23 | /*! 1、开启位图上下文 */ 24 | UIGraphicsBeginImageContextWithOptions(image.size, NO, 0) ; 25 | 26 | /*! 2、描述圆形裁剪区域 */ 27 | UIBezierPath *clipPath = [UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, image.size.width, image.size.height)] ; 28 | 29 | /*! 3、设置裁剪区域 */ 30 | [clipPath addClip] ; 31 | 32 | /*! 4、绘图 */ 33 | [image drawAtPoint:CGPointZero] ; 34 | 35 | /*! 5、取出图片 */ 36 | image = UIGraphicsGetImageFromCurrentImageContext() ; 37 | 38 | /*! 6、关闭图片上下文 */ 39 | UIGraphicsEndImageContext() ; 40 | 41 | return image ; 42 | } 43 | 44 | /*! 45 | * 传入图片,cell,imageSize,改变自定义大小的圆形系统 cell image 46 | * 47 | * @param cell cell 48 | * @param image image 可以自己切圆角:[UIImage ba_imageToRoundImageWithImage:UIImageMake(@"icon1.jpg")]; 49 | * @param imageSize 图像的 size 记得先切圆角再传 size 50 | * 51 | * @return 返回自定义大小的圆形系统 cell image 52 | */ 53 | + (UIImage *)ba_imageToChangeCellRoundImageViewSizeWithCell:(UITableViewCell *)cell 54 | image:(UIImage *)image 55 | imageSize:(CGSize)imageSize 56 | { 57 | UIImage *roundImage = [UIImage ba_imageToRoundImageWithImage:image]; 58 | UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0.0); 59 | CGRect imageRect = CGRectMake(0, 0, imageSize.width, imageSize.height); 60 | [roundImage drawInRect:imageRect]; 61 | cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext(); 62 | UIGraphicsEndImageContext(); 63 | 64 | return cell.imageView.image; 65 | } 66 | 67 | @end 68 | 69 | @implementation NSString (BAContact) 70 | 71 | 72 | /** 73 | 判断 string 是否为空 74 | 75 | @return YES:为空,NO:不为空 76 | */ 77 | - (BOOL)ba_stringIsBlank 78 | { 79 | NSCharacterSet *blank = [NSCharacterSet whitespaceAndNewlineCharacterSet]; 80 | for (NSInteger i = 0; i < self.length; ++i) { 81 | unichar c = [self characterAtIndex:i]; 82 | if (![blank characterIsMember:c]) { 83 | return NO; 84 | } 85 | } 86 | return YES; 87 | } 88 | 89 | /** 90 | 判断一个字符串里面是否包含另一个字符串 91 | 92 | @param string string 93 | @return YES/NO 94 | */ 95 | - (BOOL)ba_stringIncludesString:(NSString *)string 96 | { 97 | if ([string ba_stringIsBlank]) 98 | { 99 | return NO; 100 | } 101 | 102 | if ([self respondsToSelector:@selector(containsString:)]) 103 | { 104 | return [self containsString:string]; 105 | } 106 | 107 | return [self rangeOfString:string].location != NSNotFound; 108 | } 109 | @end 110 | -------------------------------------------------------------------------------- /BAContact/BAContactsModel.h: -------------------------------------------------------------------------------- 1 | // 2 | // BAContactsModel.h 3 | // BAQMUIDemo 4 | // 5 | // Created by boai on 2017/3/20. 6 | // Copyright © 2017年 boaihome. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface BAContactsModel : NSObject 13 | 14 | @property (nonatomic, copy) NSString *user_Name; 15 | @property (nonatomic, copy) NSString *user_Id; 16 | @property (nonatomic, copy) NSString *user_Image_url; 17 | @property (nonatomic, copy) UIImage *user_Image; 18 | @property (nonatomic, copy) NSString *user_PhoneNumber; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /BAContact/BAContactsModel.m: -------------------------------------------------------------------------------- 1 | // 2 | // BAContactsModel.m 3 | // BAQMUIDemo 4 | // 5 | // Created by boai on 2017/3/20. 6 | // Copyright © 2017年 boaihome. All rights reserved. 7 | // 8 | 9 | #import "BAContactsModel.h" 10 | 11 | @implementation BAContactsModel 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /BAContact/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSContactsUsageDescription 24 | 是否允许访问通讯录? 25 | UILaunchStoryboardName 26 | Launch Screen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /BAContact/Launch Screen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/0.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/1.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/10.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/11.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/12.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/13.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/14.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/15.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/16.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/16.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/17.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/18.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/19.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/19.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/2.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/20.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/20.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/21.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/21.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/22.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/22.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/23.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/23.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/3.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/4.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/5.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/6.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/7.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/8.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Cell_icons/9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Cell_icons/9.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/Contact_icon_ContactTag.imageset/Contact_icon_ContactTag@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/Contact_icon_ContactTag.imageset/Contact_icon_ContactTag@2x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/Contact_icon_ContactTag.imageset/Contact_icon_ContactTag@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/Contact_icon_ContactTag.imageset/Contact_icon_ContactTag@3x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/add_friend_icon_addgroup.imageset/add_friend_icon_addgroup@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/add_friend_icon_addgroup.imageset/add_friend_icon_addgroup@2x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/add_friend_icon_addgroup.imageset/add_friend_icon_addgroup@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/add_friend_icon_addgroup.imageset/add_friend_icon_addgroup@3x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/add_friend_icon_offical.imageset/add_friend_icon_offical@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/add_friend_icon_offical.imageset/add_friend_icon_offical@2x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/add_friend_icon_offical.imageset/add_friend_icon_offical@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/add_friend_icon_offical.imageset/add_friend_icon_offical@3x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/barbuttonicon_more.imageset/barbuttonicon_more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/barbuttonicon_more.imageset/barbuttonicon_more.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/barbuttonicon_more.imageset/barbuttonicon_more@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/barbuttonicon_more.imageset/barbuttonicon_more@2x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/barbuttonicon_more.imageset/barbuttonicon_more@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/barbuttonicon_more.imageset/barbuttonicon_more@3x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/contacts_add_friend.imageset/contacts_add_friend@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/contacts_add_friend.imageset/contacts_add_friend@2x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/contacts_add_friend.imageset/contacts_add_friend@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/contacts_add_friend.imageset/contacts_add_friend@3x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/plugins_FriendNotify.imageset/plugins_FriendNotify@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/plugins_FriendNotify.imageset/plugins_FriendNotify@2x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/Contacts/plugins_FriendNotify.imageset/plugins_FriendNotify@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/Contacts/plugins_FriendNotify.imageset/plugins_FriendNotify@3x.png -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/icon0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/icon0.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/icon1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/icon1.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/icon2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/icon2.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/icon3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/icon3.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/icon4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/icon4.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pbg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pbg.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic0.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic1.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic2.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic3.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic4.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic5.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic6.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic7.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/pic8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/pic8.jpg -------------------------------------------------------------------------------- /BAContact/Resource/Images/UserImages/picon.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/BAContact/Resource/Images/UserImages/picon.jpg -------------------------------------------------------------------------------- /BAContact/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/3. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | 14 | @end 15 | 16 | -------------------------------------------------------------------------------- /BAContact/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/3. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | #import "BAContactsModel.h" 11 | #import "ViewController2.h" 12 | 13 | //#import "BAContactsIndexView.h" 14 | 15 | #import 16 | #import 17 | 18 | #import "BAAlertController.h" 19 | #import "BAContact.h" 20 | 21 | 22 | static NSString * const cellID = @"BAContactViewCell"; 23 | 24 | #define cellHeight 50 25 | #define cellImageViewSize cellHeight * 0.8 26 | 27 | #define tableViewEdgeInsets UIEdgeInsetsMake(0, 15, 0, 0) 28 | 29 | @interface ViewController () 30 | 31 | @property(nonatomic, strong) UITableView *tableView; 32 | 33 | @property (nonatomic, strong) NSMutableArray *dataArray; 34 | @property (nonatomic, strong) NSMutableArray *searchResultsKeywordsArray; 35 | @property (nonatomic, strong) NSMutableArray *searchResultIndexArray; 36 | 37 | /*! 索引 */ 38 | @property (nonatomic, strong) NSMutableArray *indexArray; 39 | @property (nonatomic, strong) NSMutableArray *sectionArray; 40 | 41 | @property (nonatomic, strong) UISearchController *searchController; 42 | 43 | 44 | @property (nonatomic, strong) CNContactPickerViewController *contactPickerViewController; 45 | 46 | //@property(nonatomic, strong) BAContactsIndexView *indexView; 47 | 48 | @property(nonatomic, strong) UIView *emptyView; 49 | 50 | @end 51 | 52 | @implementation ViewController 53 | 54 | - (void)viewWillDisappear:(BOOL)animated { 55 | [super viewWillDisappear:animated]; 56 | // [self removeSearch]; 57 | } 58 | 59 | - (void)viewDidDisappear:(BOOL)animated { 60 | [super viewDidDisappear:animated]; 61 | // [self removeSearch]; 62 | } 63 | 64 | - (void)removeSearch 65 | { 66 | if (self.searchController.active) 67 | { 68 | self.searchController.active = NO; 69 | [self.searchController.searchBar removeFromSuperview]; 70 | } 71 | } 72 | 73 | - (void)viewDidLoad 74 | { 75 | [super viewDidLoad]; 76 | 77 | [self setupUI]; 78 | } 79 | 80 | - (void)setupUI 81 | { 82 | self.title = @"博爱通讯录"; 83 | self.view.backgroundColor = BAKit_Color_White_pod; 84 | self.tableView.hidden = NO; 85 | self.emptyView.hidden = YES; 86 | 87 | [self getSectionData]; 88 | [self setupNavi]; 89 | } 90 | 91 | - (void)setupNavi 92 | { 93 | UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(handleRightNaviButtonAction)]; 94 | self.navigationItem.rightBarButtonItem = rightBarButtonItem; 95 | } 96 | 97 | - (void)handleRightNaviButtonAction 98 | { 99 | self.contactPickerViewController = [[CNContactPickerViewController alloc] init]; 100 | self.contactPickerViewController.delegate = (id)self; 101 | [self presentViewController:self.contactPickerViewController animated:YES completion:nil]; 102 | 103 | [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]; 104 | } 105 | 106 | - (void)getSectionData 107 | { 108 | NSDictionary *dict = [BAKit_LocalizedIndexedCollation ba_localizedWithDataArray:self.dataArray localizedNameSEL:@selector(user_Name)]; 109 | self.indexArray = dict[kBALocalizedIndexArrayKey]; 110 | self.sectionArray = dict[kBALocalizedGroupArrayKey]; 111 | 112 | NSMutableArray *tempModel = [[NSMutableArray alloc] init]; 113 | NSArray *dicts = @[@{@"user_Name" : @"新的朋友", 114 | @"user_Image_url" : @"plugins_FriendNotify"}, 115 | @{@"user_Name" : @"群聊", 116 | @"user_Image_url" : @"add_friend_icon_addgroup"}, 117 | @{@"user_Name" : @"标签", 118 | @"user_Image_url" : @"Contact_icon_ContactTag"}, 119 | @{@"user_Name" : @"公众号", 120 | @"user_Image_url" : @"add_friend_icon_offical"}]; 121 | for (NSDictionary *dict in dicts) 122 | { 123 | BAContactsModel *model = [BAContactsModel new]; 124 | model.user_Name = dict[@"user_Name"]; 125 | model.user_Image_url = dict[@"user_Image_url"]; 126 | [tempModel addObject:model]; 127 | } 128 | 129 | [self.sectionArray insertObject:tempModel atIndex:0]; 130 | [self.indexArray insertObject:@"🔍" atIndex:0]; 131 | 132 | [self.tableView reloadData]; 133 | } 134 | 135 | - (void)viewDidLayoutSubviews { 136 | [super viewDidLayoutSubviews]; 137 | 138 | self.tableView.frame = self.view.bounds; 139 | } 140 | 141 | #pragma mark - UITableView Delegate & DataSource 142 | 143 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 144 | { 145 | if (!self.searchController.active) 146 | { 147 | return self.indexArray.count; 148 | } 149 | else 150 | { 151 | // return self.searchResultIndexArray.count; 152 | return 1; 153 | } 154 | } 155 | 156 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 157 | { 158 | if (!self.searchController.active) 159 | { 160 | return [self.sectionArray[section] count]; 161 | } 162 | return self.searchResultsKeywordsArray.count; 163 | } 164 | 165 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 166 | { 167 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID ]; 168 | if (!cell) 169 | { 170 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID]; 171 | } 172 | 173 | NSUInteger section = indexPath.section; 174 | NSUInteger row = indexPath.row; 175 | BAContactsModel *model = nil; 176 | 177 | if (!self.searchController.active) 178 | { 179 | model = self.sectionArray[section][row]; 180 | cell.textLabel.text = model.user_Name; 181 | } 182 | else 183 | { 184 | // model = self.searchResultsKeywordsArray[row]; 185 | model = self.searchResultsKeywordsArray[row]; 186 | 187 | NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:model.user_Name attributes:@{NSForegroundColorAttributeName:BAKit_Color_Black_pod}]; 188 | 189 | NSRange range = [model.user_Name rangeOfString:self.searchController.searchBar.text]; 190 | if (range.location != NSNotFound) 191 | { 192 | [attributedString addAttributes:@{NSForegroundColorAttributeName:BAKit_Color_Red_pod} range:range]; 193 | } 194 | cell.textLabel.attributedText = attributedString; 195 | } 196 | 197 | if (model.user_Image_url) 198 | { 199 | cell.imageView.image = [UIImage ba_imageToChangeCellRoundImageViewSizeWithCell:cell image:BAKit_ImageName(model.user_Image_url) imageSize:CGSizeMake(cellImageViewSize, cellImageViewSize)]; 200 | } 201 | else if (model.user_Image) 202 | { 203 | cell.imageView.image = [UIImage ba_imageToChangeCellRoundImageViewSizeWithCell:cell image:model.user_Image imageSize:CGSizeMake(cellImageViewSize, cellImageViewSize)]; 204 | } 205 | if (model.user_PhoneNumber) 206 | { 207 | cell.detailTextLabel.text = model.user_PhoneNumber; 208 | cell.detailTextLabel.font = [UIFont systemFontOfSize:12]; 209 | // cell.detailTextLabelEdgeInsets = UIEdgeInsetsMake(2, -3, 0, 0); 210 | } 211 | else 212 | { 213 | cell.detailTextLabel.text = nil; 214 | } 215 | 216 | // cell.imageEdgeInsets = UIEdgeInsetsMake(0, 15, 0, 0); 217 | // cell.textLabelEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 0); 218 | cell.separatorInset = UIEdgeInsetsMake(0, 15, 0, 0); 219 | cell.backgroundColor = BAKit_Color_Clear_pod; 220 | // [cell updateCellAppearanceWithIndexPath:indexPath]; 221 | 222 | return cell; 223 | } 224 | 225 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 226 | { 227 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 228 | 229 | NSUInteger section = indexPath.section; 230 | NSUInteger row = indexPath.row; 231 | 232 | BAContactsModel *model = nil; 233 | if (!self.searchController.active) 234 | { 235 | model = self.sectionArray[section][row]; 236 | } 237 | else 238 | { 239 | model = self.searchResultsKeywordsArray[row]; 240 | } 241 | 242 | [self ba_showAlertWithModel:model]; 243 | } 244 | 245 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 246 | { 247 | return cellHeight; 248 | } 249 | 250 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section 251 | { 252 | if (!self.searchController.active) 253 | { 254 | return self.indexArray[section]; 255 | } 256 | else 257 | { 258 | if (self.searchResultsKeywordsArray.count > 0) 259 | { 260 | return @"最佳匹配"; 261 | // return self.searchResultIndexArray[section]; 262 | } 263 | } 264 | return nil; 265 | } 266 | 267 | - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView 268 | { 269 | if (!self.searchController.active) 270 | { 271 | return self.indexArray; 272 | } 273 | return nil; 274 | } 275 | 276 | #pragma mark - UISearchControllerDelegate 277 | // 谓词搜索过滤 278 | - (void)updateSearchResultsForSearchController:(UISearchController *)searchController 279 | { 280 | NSString *searchString = [self.searchController.searchBar text]; 281 | [self.searchResultsKeywordsArray removeAllObjects]; 282 | 283 | for (BAContactsModel *model in self.dataArray) 284 | { 285 | if ([model.user_Name ba_stringIncludesString:searchString]) 286 | { 287 | [self.searchResultsKeywordsArray addObject:model]; 288 | } 289 | if (self.searchResultsKeywordsArray.count) 290 | { 291 | NSDictionary *dict = [BAKit_LocalizedIndexedCollation ba_localizedWithDataArray:self.searchResultsKeywordsArray localizedNameSEL:@selector(user_Name)]; 292 | self.searchResultIndexArray = dict[kBALocalizedIndexArrayKey]; 293 | } 294 | } 295 | 296 | if (self.searchResultsKeywordsArray.count == 0 && [self.searchController.searchBar isFirstResponder]) 297 | { 298 | self.emptyView.hidden = NO; 299 | } 300 | else 301 | { 302 | self.emptyView.hidden = YES; 303 | } 304 | [self.tableView reloadData]; 305 | } 306 | 307 | #pragma mark - UISearchControllerDelegate代理,可以省略,主要是为了验证打印的顺序 308 | - (void)willPresentSearchController:(UISearchController *)searchController 309 | { 310 | // self.indexView.hidden = YES; 311 | // [UIApplication.sharedApplication setStatusBarStyle:UIStatusBarStyleDefault animated:YES]; 312 | } 313 | 314 | - (void)didPresentSearchController:(UISearchController *)searchController 315 | { 316 | // 如果进入预编辑状态,searchBar消失(UISearchController套到TabBarController可能会出现这个情况),请添加下边这句话 317 | // [self.view addSubview:self.searchController.searchBar]; 318 | // if (![searchController.searchBar.text ba_stringIsBlank]) 319 | // { 320 | // self.searchController.dimsBackgroundDuringPresentation = NO; 321 | // } 322 | } 323 | 324 | - (void)willDismissSearchController:(UISearchController *)searchController 325 | { 326 | // [self ba_removeEmptyView]; 327 | // self.indexView.hidden = NO; 328 | // [UIApplication.sharedApplication setStatusBarStyle:UIStatusBarStyleLightContent animated:YES]; 329 | } 330 | 331 | - (void)didDismissSearchController:(UISearchController *)searchController 332 | { 333 | // [self ba_removeEmptyView]; 334 | } 335 | 336 | - (void)presentSearchController:(UISearchController *)searchController 337 | { 338 | 339 | } 340 | 341 | #pragma mark - UISearchBarDelegate 342 | - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar 343 | { 344 | self.emptyView.hidden = YES; 345 | // [self ba_removeEmptyView]; 346 | } 347 | 348 | #pragma mark - CNContactPickerDelegate 349 | - (void)contactPicker:(CNContactPickerViewController *)picker didSelectContacts:(NSArray *)contacts 350 | { 351 | for (CNContact *cont in contacts) 352 | { 353 | NSMutableDictionary *userDic = [[NSMutableDictionary alloc] init]; 354 | // 名字 355 | NSString *name = @""; 356 | if (cont.familyName) 357 | { 358 | name = [NSString stringWithFormat:@"%@",cont.familyName]; 359 | } 360 | if (cont.givenName) 361 | { 362 | name = [NSString stringWithFormat:@"%@%@",name,cont.givenName]; 363 | } 364 | [userDic setObject:name forKey:@"name"]; 365 | if (cont.organizationName) 366 | { 367 | 368 | [userDic setObject:cont.organizationName forKey:@"organizationName"]; 369 | } 370 | if (cont.imageData) 371 | { 372 | [userDic setObject:[UIImage imageWithData:cont.imageData] forKey:@"image"]; 373 | } 374 | if (cont.phoneNumbers) 375 | { 376 | for (CNLabeledValue *labeValue in cont.phoneNumbers) 377 | { 378 | CNPhoneNumber *phoneNumber = labeValue.value; 379 | NSString *phone = [[phoneNumber.stringValue componentsSeparatedByString:@"-"] componentsJoinedByString:@""]; 380 | if (phone.length == 11) 381 | { 382 | [userDic setObject:phone forKey:@"phone"]; 383 | } 384 | } 385 | } 386 | 387 | BAContactsModel *model = [[BAContactsModel alloc] init]; 388 | model.user_Name = userDic[@"name"]; 389 | model.user_Image = userDic[@"image"]; 390 | model.user_PhoneNumber = userDic[@"phone"]; 391 | 392 | if (![model.user_Name ba_stringIsBlank]) 393 | { 394 | if ([self ba_isArray:self.dataArray containsObject:model]) 395 | { 396 | BAKit_ShowAlertWithMsg_ios8(@"此联系人已添加,请勿重复添加!"); 397 | } 398 | else 399 | { 400 | [self.dataArray addObject:model]; 401 | } 402 | } 403 | } 404 | 405 | [self getSectionData]; 406 | } 407 | 408 | #pragma mark - custom Method 409 | - (BOOL)ba_isArray:(NSArray *)array containsObject:(BAContactsModel *)object 410 | { 411 | __block BOOL isExist = NO; 412 | [array enumerateObjectsUsingBlock:^(BAContactsModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) 413 | { 414 | if ([obj.user_Name isEqualToString:object.user_Name]) 415 | { 416 | // 数组中已经存在该对象 417 | *stop = YES; 418 | isExist = YES; 419 | } 420 | }]; 421 | if (!isExist) 422 | { 423 | // 如果不存在就添加进去 424 | isExist = NO; 425 | } 426 | return isExist; 427 | } 428 | 429 | - (void)handleAboutItemEvent 430 | { 431 | self.contactPickerViewController = [[CNContactPickerViewController alloc] init]; 432 | self.contactPickerViewController.delegate = (id)self; 433 | [self presentViewController:self.contactPickerViewController animated:YES completion:nil]; 434 | 435 | [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts]; 436 | } 437 | 438 | - (void)ba_showAlertWithModel:(BAContactsModel *)model 439 | { 440 | NSMutableAttributedString *attributedTitle = [[NSMutableAttributedString alloc] initWithString:@"博爱温馨提示" attributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]}]; 441 | 442 | NSString *message = [NSString stringWithFormat:@"你点击了 %@ !", model.user_Name]; 443 | NSString *keyWord = model.user_Name; 444 | 445 | /*! 关键字添加效果 */ 446 | NSMutableAttributedString *attributedMessage = [[NSMutableAttributedString alloc] initWithString:message attributes:@{NSForegroundColorAttributeName:[UIColor orangeColor]}]; 447 | 448 | /*! 获取关键字位置 */ 449 | NSRange range = [message rangeOfString:keyWord]; 450 | NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:20], 451 | NSForegroundColorAttributeName:[UIColor blackColor], 452 | NSKernAttributeName:@2.0, 453 | NSStrikethroughStyleAttributeName:@(NSUnderlineStyleSingle), 454 | NSStrokeColorAttributeName:[UIColor blueColor], 455 | NSStrokeWidthAttributeName:@2.0, 456 | NSVerticalGlyphFormAttributeName:@(0)}; 457 | 458 | /*! 设置关键字属性 */ 459 | [attributedMessage ba_changeAttributeDict:dic range:range]; 460 | 461 | BAKit_WeakSelf 462 | [UIAlertController ba_alertAttributedShowInViewController:self attributedTitle:attributedTitle attributedMessage:attributedMessage buttonTitleArray:@[@"取 消", @"确 定"] buttonTitleColorArray:@[BAKit_Color_Green_pod, BAKit_Color_Red_pod] block:^(UIAlertController * _Nonnull alertController, UIAlertAction * _Nonnull action, NSInteger buttonIndex) { 463 | BAKit_StrongSelf 464 | if (buttonIndex == 0) 465 | { 466 | NSLog(@"你点击了取消按钮!"); 467 | } 468 | else if (buttonIndex == 1) 469 | { 470 | [UIView animateWithDuration:0.2f animations:^{ 471 | UIViewController *vc = [ViewController2 new]; 472 | vc.title = model.user_Name; 473 | [self.navigationController pushViewController:vc animated:YES]; 474 | }]; 475 | } 476 | return; 477 | }]; 478 | } 479 | 480 | - (void)ba_removeEmptyView 481 | { 482 | [self.emptyView removeFromSuperview]; 483 | self.emptyView = nil; 484 | } 485 | 486 | #pragma mark - setter / getter 487 | - (UITableView *)tableView 488 | { 489 | if (!_tableView) 490 | { 491 | _tableView = [[UITableView alloc] init]; 492 | self.tableView.backgroundColor = BAKit_Color_Clear_pod; 493 | self.tableView.delegate = self; 494 | self.tableView.dataSource = self; 495 | 496 | self.tableView.estimatedRowHeight = 44; 497 | self.tableView.rowHeight = UITableViewAutomaticDimension; 498 | self.tableView.tableFooterView = [UIView new]; 499 | // 更改索引的背景颜色 500 | self.tableView.sectionIndexBackgroundColor = BAKit_Color_Clear_pod; 501 | // 更改索引的文字颜色 502 | // self.tableView.sectionIndexColor = BAKit_Color_Orange; 503 | // self.tableView.sectionIndexTrackingBackgroundColor = BAKit_Color_Red_pod; 504 | 505 | [self.view addSubview:self.tableView]; 506 | } 507 | return _tableView; 508 | } 509 | 510 | - (UISearchController *)searchController 511 | { 512 | if (!_searchController) 513 | { 514 | // 创建UISearchController 515 | self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; 516 | //设置代理 517 | self.searchController.delegate = self; 518 | self.searchController.searchResultsUpdater = self; 519 | self.searchController.searchBar.delegate = self; 520 | 521 | //包着搜索框外层的颜色 522 | // self.searchController.searchBar.barTintColor = [UIColor yellowColor]; 523 | 524 | // placeholder 525 | self.searchController.searchBar.placeholder = @"搜索"; 526 | self.searchController.searchBar.searchBarStyle = UISearchBarStyleMinimal; 527 | // 顶部提示文本,相当于控件的Title 528 | // self.searchController.searchBar.prompt = @"Prompt"; 529 | // 搜索框样式 530 | // self.searchController.searchBar.barStyle = UIBarMetricsDefault; 531 | // 位置 532 | self.searchController.searchBar.frame = CGRectMake(self.searchController.searchBar.frame.origin.x, self.searchController.searchBar.frame.origin.y, BAKit_SCREEN_WIDTH, 44.0); 533 | // [self.searchController.searchBar setSearchTextPositionAdjustment:UIOffsetMake(30, 0)]; 534 | // 改变系统自带的“cancel”为“取消” 535 | [self.searchController.searchBar setValue:@"取消" forKey:@"_cancelButtonText"]; 536 | self.searchController.searchBar.tintColor = BAKit_Color_Red_pod; 537 | // self.searchController.searchBar.backgroundColor = BAKit_Color_Green_pod; 538 | 539 | // 是否提供自动修正功能(这个方法一般都不用的) 540 | // 设置自动检查的类型 541 | [self.searchController.searchBar setSpellCheckingType:UITextSpellCheckingTypeYes]; 542 | [self.searchController.searchBar setAutocorrectionType:UITextAutocorrectionTypeDefault];// 是否提供自动修正功能,一般设置为UITextAutocorrectionTypeDefault 543 | [self.searchController.searchBar sizeToFit]; 544 | 545 | 546 | // 是否显示灰色透明的蒙版,默认 YES,点击事件无效 547 | self.searchController.dimsBackgroundDuringPresentation = NO; 548 | // 是否隐藏导航条,这个一般不需要管,都是隐藏的 549 | // self.searchController.hidesNavigationBarDuringPresentation = YES; 550 | // 搜索时,背景变模糊 551 | // self.searchController.obscuresBackgroundDuringPresentation = NO; 552 | 553 | //点击搜索的时候,是否隐藏导航栏 554 | // self.searchController.hidesNavigationBarDuringPresentation = NO; 555 | 556 | // 如果进入预编辑状态,searchBar消失(UISearchController套到TabBarController可能会出现这个情况),请添加下边这句话 557 | self.definesPresentationContext = YES; 558 | // 添加 searchbar 到 headerview 559 | self.tableView.tableHeaderView = self.searchController.searchBar; 560 | } 561 | return _searchController; 562 | } 563 | 564 | - (NSMutableArray *)searchResultsKeywordsArray 565 | { 566 | if(_searchResultsKeywordsArray == nil) 567 | { 568 | _searchResultsKeywordsArray = [[NSMutableArray alloc] init]; 569 | } 570 | return _searchResultsKeywordsArray; 571 | } 572 | 573 | - (NSMutableArray *)dataArray 574 | { 575 | if(_dataArray == nil) 576 | { 577 | _dataArray = [[NSMutableArray alloc] init]; 578 | 579 | NSArray *iconImageNamesArray = @[@"0.jpg", 580 | @"1.jpg", 581 | @"2.jpg", 582 | @"3.jpg", 583 | @"icon3.jpg", 584 | @"icon4.jpg", 585 | @"5.jpg", 586 | @"6.jpg", 587 | @"7.jpg", 588 | ]; 589 | NSArray *namesArray = @[@"博爱", 590 | @"boai", 591 | @"小明", 592 | @"陆晓峰", 593 | @"石少庸是小明的老师", 594 | @"石少庸", 595 | @"Alix", 596 | @"Tom", 597 | @"Tomb", 598 | @"Lucy", 599 | @"123", 600 | @"cydn", 601 | @"mami", 602 | @"888", 603 | @"zhangSan", 604 | @"王二", 605 | @"微信", 606 | @"张小龙"]; 607 | 608 | NSMutableArray *iconArray = [NSMutableArray array]; 609 | for (NSInteger i = 0; i < namesArray.count; i ++) 610 | { 611 | if (iconImageNamesArray.count < namesArray.count) 612 | { 613 | for (NSInteger j = 0; j < iconImageNamesArray.count; j ++) 614 | { 615 | [iconArray addObject:iconImageNamesArray[BAKit_RandomNumber_pod(iconImageNamesArray.count)]]; 616 | } 617 | } 618 | BAContactsModel *model = [[BAContactsModel alloc] init]; 619 | model.user_Image_url = iconArray[i]; 620 | model.user_Name = namesArray[i]; 621 | 622 | [self.dataArray addObject:model]; 623 | } 624 | } 625 | return _dataArray; 626 | } 627 | 628 | - (NSMutableArray *)indexArray 629 | { 630 | if(_indexArray == nil) 631 | { 632 | _indexArray = [[NSMutableArray alloc] init]; 633 | } 634 | return _indexArray; 635 | } 636 | 637 | - (NSMutableArray *)sectionArray 638 | { 639 | if(_sectionArray == nil) 640 | { 641 | _sectionArray = [[NSMutableArray alloc] init]; 642 | } 643 | return _sectionArray; 644 | } 645 | 646 | //- (NSMutableArray *)searchResultIndexArray 647 | //{ 648 | // if(_searchResultIndexArray == nil) 649 | // { 650 | // _searchResultIndexArray = [[NSMutableArray alloc] init]; 651 | // } 652 | // return _searchResultIndexArray; 653 | //} 654 | 655 | - (UIView *)emptyView 656 | { 657 | if (!_emptyView) 658 | { 659 | _emptyView = [UIView new]; 660 | _emptyView.backgroundColor = BAKit_Color_Clear_pod; 661 | self.emptyView.frame = CGRectMake(100, 100, 150, 150); 662 | 663 | UILabel *label = [UILabel new]; 664 | label.frame = _emptyView.bounds; 665 | label.font = [UIFont systemFontOfSize:14]; 666 | label.text = @"没有搜索到相关数据!"; 667 | 668 | [_emptyView addSubview:label]; 669 | [self.view addSubview:_emptyView]; 670 | } 671 | return _emptyView; 672 | } 673 | 674 | - (void)dealloc 675 | { 676 | 677 | } 678 | 679 | 680 | 681 | @end 682 | -------------------------------------------------------------------------------- /BAContact/ViewController2.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController2.h 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/4. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController2 : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /BAContact/ViewController2.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController2.m 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/4. 6 | // Copyright © 2017年 boai. All rights reserved. 7 | // 8 | 9 | #import "ViewController2.h" 10 | 11 | @interface ViewController2 () 12 | 13 | @end 14 | 15 | @implementation ViewController2 16 | 17 | - (void)viewDidLoad { 18 | [super viewDidLoad]; 19 | // Do any additional setup after loading the view. 20 | 21 | self.view.backgroundColor = [UIColor whiteColor]; 22 | } 23 | 24 | 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /BAContact/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // BAContact 4 | // 5 | // Created by boai on 2017/8/3. 6 | // Copyright © 2017年 boai. 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 | -------------------------------------------------------------------------------- /Images/BAContact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/Images/BAContact.png -------------------------------------------------------------------------------- /Images/BAContact1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/Images/BAContact1.png -------------------------------------------------------------------------------- /Images/BAContact2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/Images/BAContact2.png -------------------------------------------------------------------------------- /Images/BAContact3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BAHome/BAContact/c899d013bdbf30dadbbbdd5f78313689ea349ed5/Images/BAContact3.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 boai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BAContact 2 | 3 | [![BAHome Team Name](https://img.shields.io/badge/Team-BAHome-brightgreen.svg?style=flat)](https://github.com/BAHome "BAHome Team") 4 | ![](https://img.shields.io/badge/platform-iOS-red.svg) ![](https://img.shields.io/badge/language-Objective--C-orange.svg) 5 | ![](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg) 6 | ![](https://img.shields.io/cocoapods/v/BAContact.svg?style=flat) ![](https://img.shields.io/cocoapods/dt/BAContact.svg 7 | ) [![](https://img.shields.io/badge/微博-博爱1616-red.svg)](http://weibo.com/538298123) 8 | 9 | ## 1、功能及简介 10 | * 1、通讯录,最简单的中英文混合排序封装,微信通讯录 demo!
11 | * 2、获取系统通讯录内容,然后添加到自定义通讯录
12 | * 3、UISearchController 的详细使用方法
13 | 14 | ## 2、图片示例 15 | ![BAContact1.png](https://github.com/BAHome/BAContact/blob/master/Images/BAContact1.png) 16 | ![BAContact2.png](https://github.com/BAHome/BAContact/blob/master/Images/BAContact2.png) 17 | ![BAContact3.png](https://github.com/BAHome/BAContact/blob/master/Images/BAContact3.png) 18 | 19 | ## 3、安装、导入示例和源码地址 20 | * 1、pod 导入【最新版本:![](https://img.shields.io/cocoapods/v/BAContact.svg?style=flat)】:
21 | `pod 'BAContact'`
22 | 如果发现 `pod search BAContact` 搜索出来的不是最新版本,需要在终端执行 cd 转换文件路径命令退回到 desktop,然后执行 `pod setup` 命令更新本地spec缓存(可能需要几分钟),然后再搜索就可以了。
23 | 具体步骤: 24 | - pod setup : 初始化 25 | - pod repo update : 更新仓库 26 | - pod search BAContact 27 | * 2、文件夹拖入:下载demo,把 BAContact 文件夹拖入项目即可,
28 | * 3、导入头文件:
29 | ` #import "BAContact.h" `
30 | * 4、项目源码地址:
31 | OC 版 :[https://github.com/BAHome/BAContact](https://github.com/BAHome/BAContact)
32 | 33 | ## 4、BAContact 的类结构及 demo 示例 34 | ![BAContact.png](https://github.com/BAHome/BAContact/blob/master/Images/BAContact.png) 35 | 36 | ### BAContact.h 37 | ``` 38 | #ifndef BAContact_h 39 | #define BAContact_h 40 | 41 | 42 | // 系统自带的中英文混合排序 43 | #import "BAKit_LocalizedIndexedCollation.h" 44 | 45 | #import "BAKit_ConfigurationDefine.h" 46 | #import "UIImage+BAContact.h" 47 | 48 | /*! 49 | ********************************************************************************* 50 | ************************************ 更新说明 ************************************ 51 | ********************************************************************************* 52 | 53 | 欢迎使用 BAHome 系列开源代码 ! 54 | 如有更多需求,请前往:https://github.com/BAHome 55 | 56 | 项目源码地址: 57 | OC 版 :https://github.com/BAHome/BAContact 58 | 59 | 最新更新时间:2017-08-05 【倒叙】
60 | 最新Version:【Version:1.0.0】
61 | 更新内容:
62 | 1.0.0.1、通讯录,最简单的中英文混合排序封装,微信通讯录 demo!
63 | 1.0.0.2、获取系统通讯录内容,然后添加到自定义通讯录
64 | 1.0.0.3、UISearchController 的详细使用方法
65 | */ 66 | 67 | #endif /* BAContact_h */ 68 | ``` 69 | 70 | ### BAKit_LocalizedIndexedCollation.h 71 | ``` 72 | #import 73 | #import 74 | 75 | /*! 索引 */ 76 | #define kBALocalizedIndexArrayKey @"kBALocalizedIndexArrayKey" 77 | /*! 排序后的分组,可以为 model */ 78 | #define kBALocalizedGroupArrayKey @"kBALocalizedGroupArrayKey" 79 | 80 | @interface BAKit_LocalizedIndexedCollation : NSObject 81 | 82 | /*! 83 | 对数组排序 84 | 85 | @param dataArray 需要排序的数组,可以为 model 86 | @param localizedNameSEL 数组中对象需要排序的属性,可以为 model.userName 87 | 88 | @return 排序后的索引及 groupArray 字典形式 kBALocalizedIndexArrayKey kBALocalizedGroupArrayKey 89 | */ 90 | + (NSDictionary *)ba_localizedWithDataArray:(NSMutableArray *)dataArray 91 | localizedNameSEL:(SEL)localizedNameSEL; 92 | 93 | @end 94 | ``` 95 | 96 | ### demo 示例 97 | ``` 98 | - (void)getSectionData 99 | { 100 | NSDictionary *dict = [BAKit_LocalizedIndexedCollation ba_localizedWithDataArray:self.dataArray localizedNameSEL:@selector(user_Name)]; 101 | self.indexArray = dict[kBALocalizedIndexArrayKey]; 102 | self.sectionArray = dict[kBALocalizedGroupArrayKey]; 103 | 104 | NSMutableArray *tempModel = [[NSMutableArray alloc] init]; 105 | NSArray *dicts = @[@{@"user_Name" : @"新的朋友", 106 | @"user_Image_url" : @"plugins_FriendNotify"}, 107 | @{@"user_Name" : @"群聊", 108 | @"user_Image_url" : @"add_friend_icon_addgroup"}, 109 | @{@"user_Name" : @"标签", 110 | @"user_Image_url" : @"Contact_icon_ContactTag"}, 111 | @{@"user_Name" : @"公众号", 112 | @"user_Image_url" : @"add_friend_icon_offical"}]; 113 | for (NSDictionary *dict in dicts) 114 | { 115 | BAContactsModel *model = [BAContactsModel new]; 116 | model.user_Name = dict[@"user_Name"]; 117 | model.user_Image_url = dict[@"user_Image_url"]; 118 | [tempModel addObject:model]; 119 | } 120 | 121 | [self.sectionArray insertObject:tempModel atIndex:0]; 122 | [self.indexArray insertObject:@"🔍" atIndex:0]; 123 | 124 | [self.tableView reloadData]; 125 | } 126 | 127 | 其他示例可下载demo查看源码! 128 | ``` 129 | 130 | ## 5、更新记录:【倒叙】 131 | 欢迎使用 [【BAHome】](https://github.com/BAHome) 系列开源代码 ! 132 | 如有更多需求,请前往:[【https://github.com/BAHome】](https://github.com/BAHome) 133 | 134 | 135 | 最新更新时间:2017-08-05 【倒叙】
136 | 最新Version:【Version:1.0.0】
137 | 更新内容:
138 | 1.0.0.1、通讯录,最简单的中英文混合排序封装,微信通讯录 demo!
139 | 1.0.0.2、获取系统通讯录内容,然后添加到自定义通讯录
140 | 1.0.0.3、UISearchController 的详细使用方法
141 | 142 | ## 6、bug 反馈 143 | > 1、开发中遇到 bug,希望小伙伴儿们能够及时反馈与我们 BAHome 团队,我们必定会认真对待每一个问题!
144 | 145 | > 2、以后提需求和 bug 的同学,记得把 git 或者博客链接给我们,我直接超链到你们那里!希望大家积极参与测试!
146 | 147 | ## 7、BAHome 团队成员 148 | > 1、QQ 群 149 | 479663605
150 | 【注意:此群为 2 元 付费群,介意的小伙伴儿勿扰!】
151 | 152 | > 孙博岩
153 | QQ:137361770
154 | git:[https://github.com/boai](https://github.com/boai)
155 | 简书:[http://www.jianshu.com/u/95c9800fdf47](http://www.jianshu.com/u/95c9800fdf47)
156 | 微博:[![](https://img.shields.io/badge/微博-博爱1616-red.svg)](http://weibo.com/538298123)
157 | 158 | > 马景丽
159 | QQ:1253540493
160 | git:[https://github.com/MaJingli](https://github.com/MaJingli)
161 | 162 | > 陆晓峰
163 | QQ:442171865
164 | git:[https://github.com/zeR0Lu](https://github.com/zeR0Lu)
165 | 166 | > 陈集
167 | QQ:3161182978
168 | git:[https://github.com/chenjipdc](https://github.com/chenjipdc)
169 | 简书:[http://www.jianshu.com/u/90ae559fc21d](http://www.jianshu.com/u/90ae559fc21d) 170 | 171 | > 任子丰
172 | QQ:459643690
173 | git:[https://github.com/renzifeng](https://github.com/renzifeng)
174 | 175 | > 吴丰收
176 | QQ:498121294
177 | 178 | > 石少庸
179 | QQ:363605775
180 | git:[https://github.com/CrazyCoderShi](https://github.com/CrazyCoderShi)
181 | 简书:[http://www.jianshu.com/u/0726f4d689a3](http://www.jianshu.com/u/0726f4d689a3) 182 | 183 | > 丁寅初
184 | QQ:1137155216
185 | git:[https://github.com/1137155216](https://github.com/1137155216)
186 | 博客园:[http://www.cnblogs.com/ios-dyc1998](http://www.cnblogs.com/ios-dyc1998) 187 | 188 | > 唐海洋
189 | QQ:790015339
190 | git:[https://github.com/tanghaiyang1992](https://github.com/tanghaiyang1992)
191 | 简书:[http://www.jianshu.com/u/b833cfd6bd58](http://www.jianshu.com/u/b833cfd6bd58) 192 | 193 | > 权军刚
194 | QQ:906910380
195 | git:[https://github.com/Gang679](https://github.com/Gang679)
196 | 简书:[http://www.jianshu.com/u/ab83189244d9](http://www.jianshu.com/u/ab83189244d9) 197 | 198 | ## 8、开发环境 和 支持版本 199 | > 开发使用 最新版本 Xcode,理论上支持 iOS 8 及以上版本,如有版本适配问题,请及时反馈!多谢合作! 200 | 201 | ## 9、感谢 202 | > 感谢 [BAHome](https://github.com/BAHome) 团队成员倾力合作,后期会推出一系列 常用 UI 控件的封装,大家有需求得也可以在 issue 提出,如果合理,我们会尽快推出新版本!
203 | 204 | > [BAHome](https://github.com/BAHome) 的发展离不开小伙伴儿的信任与推广,再次感谢各位小伙伴儿的支持! 205 | 206 | --------------------------------------------------------------------------------