├── .gitignore ├── ChangeIcon ├── ChangeIcon.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── ChangeIcon │ ├── APPIcon │ ├── Sunday │ │ ├── Sunday29x29@2x.png │ │ ├── Sunday29x29@3x.png │ │ ├── Sunday40x40@2x.png │ │ ├── Sunday40x40@3x.png │ │ ├── Sunday60x60@2x.png │ │ └── Sunday60x60@3x.png │ ├── 天天特价@2x.png │ ├── 天天特价@3x.png │ ├── 小房子@2x.png │ ├── 小房子@3x.png │ ├── 小猫@2x.png │ ├── 小猫@3x.png │ ├── 邮件信息@2x.png │ ├── 邮件信息@3x.png │ ├── 默认icon@2x.png │ └── 默认icon@3x.png │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── APPIcon │ │ ├── Contents.json │ │ ├── 小房子.imageset │ │ │ ├── Contents.json │ │ │ ├── 小房子@2x.png │ │ │ └── 小房子@3x.png │ │ └── 小猫.imageset │ │ │ ├── Contents.json │ │ │ ├── 小猫@2x.png │ │ │ └── 小猫@3x.png │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-29@2x.png │ │ ├── Icon-29@3x.png │ │ ├── Icon-40.png │ │ ├── Icon-40@2x.png │ │ ├── Icon-40@3x.png │ │ ├── Icon-60.png │ │ ├── Icon-60@2x.png │ │ ├── Icon-60@3x.png │ │ └── icon1024.jpg │ ├── Contents.json │ └── 邮件信息.imageset │ │ ├── Contents.json │ │ ├── 邮件信息@2x.png │ │ └── 邮件信息@3x.png │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── ChangeIcon.xcdatamodeld │ ├── .xccurrentversion │ └── ChangeIcon.xcdatamodel │ │ └── contents │ ├── Info.plist │ ├── ViewController.swift │ ├── icon尺寸图 │ ├── MoreSizeViewController.swift │ └── MoreSizeViewController.xib │ ├── 无弹框 │ ├── Extension-Dispatch.swift │ ├── NoAlertChangeViewController.swift │ └── NoAlertChangeViewController.xib │ └── 有弹框 │ ├── AlertChangeViewController.swift │ └── AlertChangeViewController.xib ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | .build/ 41 | 42 | # CocoaPods 43 | # 44 | # We recommend against adding the Pods directory to your .gitignore. However 45 | # you should judge for yourself, the pros and cons are mentioned at: 46 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 47 | # 48 | # Pods/ 49 | 50 | # Carthage 51 | # 52 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 53 | # Carthage/Checkouts 54 | 55 | Carthage/Build 56 | 57 | # fastlane 58 | # 59 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 60 | # screenshots whenever they are needed. 61 | # For more information about the recommended setup visit: 62 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 63 | 64 | fastlane/report.xml 65 | fastlane/Preview.html 66 | fastlane/screenshots 67 | fastlane/test_output 68 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 77673AB9205BC88200C524EE /* MoreSizeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 77673AB7205BC88200C524EE /* MoreSizeViewController.swift */; }; 11 | 77673ABA205BC88200C524EE /* MoreSizeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 77673AB8205BC88200C524EE /* MoreSizeViewController.xib */; }; 12 | 77673AC2205BCD8700C524EE /* Sunday29x29@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77673ABC205BCD8700C524EE /* Sunday29x29@2x.png */; }; 13 | 77673AC3205BCD8700C524EE /* Sunday29x29@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77673ABD205BCD8700C524EE /* Sunday29x29@3x.png */; }; 14 | 77673AC4205BCD8700C524EE /* Sunday40x40@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77673ABE205BCD8700C524EE /* Sunday40x40@2x.png */; }; 15 | 77673AC5205BCD8700C524EE /* Sunday40x40@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77673ABF205BCD8700C524EE /* Sunday40x40@3x.png */; }; 16 | 77673AC6205BCD8700C524EE /* Sunday60x60@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77673AC0205BCD8700C524EE /* Sunday60x60@2x.png */; }; 17 | 77673AC7205BCD8700C524EE /* Sunday60x60@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 77673AC1205BCD8700C524EE /* Sunday60x60@3x.png */; }; 18 | 776A11EC20594931008FA263 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776A11EB20594931008FA263 /* AppDelegate.swift */; }; 19 | 776A11EE20594931008FA263 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776A11ED20594931008FA263 /* ViewController.swift */; }; 20 | 776A11F120594931008FA263 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 776A11EF20594931008FA263 /* Main.storyboard */; }; 21 | 776A11F420594931008FA263 /* ChangeIcon.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 776A11F220594931008FA263 /* ChangeIcon.xcdatamodeld */; }; 22 | 776A11F620594931008FA263 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 776A11F520594931008FA263 /* Assets.xcassets */; }; 23 | 776A11F920594931008FA263 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 776A11F720594931008FA263 /* LaunchScreen.storyboard */; }; 24 | 776A120520594CD3008FA263 /* AlertChangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776A120320594CD3008FA263 /* AlertChangeViewController.swift */; }; 25 | 776A120620594CD3008FA263 /* AlertChangeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 776A120420594CD3008FA263 /* AlertChangeViewController.xib */; }; 26 | 776A120920594CE0008FA263 /* NoAlertChangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776A120720594CE0008FA263 /* NoAlertChangeViewController.swift */; }; 27 | 776A120A20594CE0008FA263 /* NoAlertChangeViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 776A120820594CE0008FA263 /* NoAlertChangeViewController.xib */; }; 28 | 778B4128205A115800992EA4 /* 天天特价@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B4126205A115800992EA4 /* 天天特价@2x.png */; }; 29 | 778B4129205A115800992EA4 /* 天天特价@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B4127205A115800992EA4 /* 天天特价@3x.png */; }; 30 | 778B4130205A116900992EA4 /* 邮件信息@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B412A205A116900992EA4 /* 邮件信息@2x.png */; }; 31 | 778B4131205A116900992EA4 /* 邮件信息@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B412B205A116900992EA4 /* 邮件信息@3x.png */; }; 32 | 778B4132205A116900992EA4 /* 小猫@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B412C205A116900992EA4 /* 小猫@2x.png */; }; 33 | 778B4133205A116900992EA4 /* 小猫@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B412D205A116900992EA4 /* 小猫@3x.png */; }; 34 | 778B4134205A116900992EA4 /* 小房子@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B412E205A116900992EA4 /* 小房子@2x.png */; }; 35 | 778B4135205A116900992EA4 /* 小房子@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B412F205A116900992EA4 /* 小房子@3x.png */; }; 36 | 778B4138205A12AB00992EA4 /* 默认icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B4136205A12AB00992EA4 /* 默认icon@2x.png */; }; 37 | 778B4139205A12AB00992EA4 /* 默认icon@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 778B4137205A12AB00992EA4 /* 默认icon@3x.png */; }; 38 | 778B413B205A619700992EA4 /* Extension-Dispatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 778B413A205A619700992EA4 /* Extension-Dispatch.swift */; }; 39 | /* End PBXBuildFile section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 77673AB7205BC88200C524EE /* MoreSizeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoreSizeViewController.swift; sourceTree = ""; }; 43 | 77673AB8205BC88200C524EE /* MoreSizeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MoreSizeViewController.xib; sourceTree = ""; }; 44 | 77673ABC205BCD8700C524EE /* Sunday29x29@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Sunday29x29@2x.png"; sourceTree = ""; }; 45 | 77673ABD205BCD8700C524EE /* Sunday29x29@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Sunday29x29@3x.png"; sourceTree = ""; }; 46 | 77673ABE205BCD8700C524EE /* Sunday40x40@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Sunday40x40@2x.png"; sourceTree = ""; }; 47 | 77673ABF205BCD8700C524EE /* Sunday40x40@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Sunday40x40@3x.png"; sourceTree = ""; }; 48 | 77673AC0205BCD8700C524EE /* Sunday60x60@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Sunday60x60@2x.png"; sourceTree = ""; }; 49 | 77673AC1205BCD8700C524EE /* Sunday60x60@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Sunday60x60@3x.png"; sourceTree = ""; }; 50 | 776A11E820594931008FA263 /* ChangeIcon.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ChangeIcon.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 776A11EB20594931008FA263 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 52 | 776A11ED20594931008FA263 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 53 | 776A11F020594931008FA263 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 54 | 776A11F320594931008FA263 /* ChangeIcon.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = ChangeIcon.xcdatamodel; sourceTree = ""; }; 55 | 776A11F520594931008FA263 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 776A11F820594931008FA263 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 776A11FA20594931008FA263 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | 776A120320594CD3008FA263 /* AlertChangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertChangeViewController.swift; sourceTree = ""; }; 59 | 776A120420594CD3008FA263 /* AlertChangeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AlertChangeViewController.xib; sourceTree = ""; }; 60 | 776A120720594CE0008FA263 /* NoAlertChangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoAlertChangeViewController.swift; sourceTree = ""; }; 61 | 776A120820594CE0008FA263 /* NoAlertChangeViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NoAlertChangeViewController.xib; sourceTree = ""; }; 62 | 778B4126205A115800992EA4 /* 天天特价@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "天天特价@2x.png"; sourceTree = ""; }; 63 | 778B4127205A115800992EA4 /* 天天特价@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "天天特价@3x.png"; sourceTree = ""; }; 64 | 778B412A205A116900992EA4 /* 邮件信息@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "邮件信息@2x.png"; sourceTree = ""; }; 65 | 778B412B205A116900992EA4 /* 邮件信息@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "邮件信息@3x.png"; sourceTree = ""; }; 66 | 778B412C205A116900992EA4 /* 小猫@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "小猫@2x.png"; sourceTree = ""; }; 67 | 778B412D205A116900992EA4 /* 小猫@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "小猫@3x.png"; sourceTree = ""; }; 68 | 778B412E205A116900992EA4 /* 小房子@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "小房子@2x.png"; sourceTree = ""; }; 69 | 778B412F205A116900992EA4 /* 小房子@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "小房子@3x.png"; sourceTree = ""; }; 70 | 778B4136205A12AB00992EA4 /* 默认icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "默认icon@2x.png"; sourceTree = ""; }; 71 | 778B4137205A12AB00992EA4 /* 默认icon@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "默认icon@3x.png"; sourceTree = ""; }; 72 | 778B413A205A619700992EA4 /* Extension-Dispatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension-Dispatch.swift"; sourceTree = ""; }; 73 | /* End PBXFileReference section */ 74 | 75 | /* Begin PBXFrameworksBuildPhase section */ 76 | 776A11E520594931008FA263 /* Frameworks */ = { 77 | isa = PBXFrameworksBuildPhase; 78 | buildActionMask = 2147483647; 79 | files = ( 80 | ); 81 | runOnlyForDeploymentPostprocessing = 0; 82 | }; 83 | /* End PBXFrameworksBuildPhase section */ 84 | 85 | /* Begin PBXGroup section */ 86 | 77673ABB205BCD8700C524EE /* Sunday */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 77673ABC205BCD8700C524EE /* Sunday29x29@2x.png */, 90 | 77673ABD205BCD8700C524EE /* Sunday29x29@3x.png */, 91 | 77673ABE205BCD8700C524EE /* Sunday40x40@2x.png */, 92 | 77673ABF205BCD8700C524EE /* Sunday40x40@3x.png */, 93 | 77673AC0205BCD8700C524EE /* Sunday60x60@2x.png */, 94 | 77673AC1205BCD8700C524EE /* Sunday60x60@3x.png */, 95 | ); 96 | path = Sunday; 97 | sourceTree = ""; 98 | }; 99 | 776A11DF20594931008FA263 = { 100 | isa = PBXGroup; 101 | children = ( 102 | 776A11EA20594931008FA263 /* ChangeIcon */, 103 | 776A11E920594931008FA263 /* Products */, 104 | ); 105 | sourceTree = ""; 106 | }; 107 | 776A11E920594931008FA263 /* Products */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 776A11E820594931008FA263 /* ChangeIcon.app */, 111 | ); 112 | name = Products; 113 | sourceTree = ""; 114 | }; 115 | 776A11EA20594931008FA263 /* ChangeIcon */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | 778B4125205A115800992EA4 /* APPIcon */, 119 | 776A120120594CB0008FA263 /* 无弹框 */, 120 | 778B413C205A68B700992EA4 /* icon尺寸图 */, 121 | 776A120020594CB0008FA263 /* 有弹框 */, 122 | 776A11EB20594931008FA263 /* AppDelegate.swift */, 123 | 776A11ED20594931008FA263 /* ViewController.swift */, 124 | 776A11EF20594931008FA263 /* Main.storyboard */, 125 | 776A11F520594931008FA263 /* Assets.xcassets */, 126 | 776A11F720594931008FA263 /* LaunchScreen.storyboard */, 127 | 776A11FA20594931008FA263 /* Info.plist */, 128 | 776A11F220594931008FA263 /* ChangeIcon.xcdatamodeld */, 129 | ); 130 | path = ChangeIcon; 131 | sourceTree = ""; 132 | }; 133 | 776A120020594CB0008FA263 /* 有弹框 */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | 776A120320594CD3008FA263 /* AlertChangeViewController.swift */, 137 | 776A120420594CD3008FA263 /* AlertChangeViewController.xib */, 138 | ); 139 | path = "有弹框"; 140 | sourceTree = ""; 141 | }; 142 | 776A120120594CB0008FA263 /* 无弹框 */ = { 143 | isa = PBXGroup; 144 | children = ( 145 | 776A120720594CE0008FA263 /* NoAlertChangeViewController.swift */, 146 | 776A120820594CE0008FA263 /* NoAlertChangeViewController.xib */, 147 | 778B413A205A619700992EA4 /* Extension-Dispatch.swift */, 148 | ); 149 | path = "无弹框"; 150 | sourceTree = ""; 151 | }; 152 | 778B4125205A115800992EA4 /* APPIcon */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 77673ABB205BCD8700C524EE /* Sunday */, 156 | 778B4126205A115800992EA4 /* 天天特价@2x.png */, 157 | 778B4127205A115800992EA4 /* 天天特价@3x.png */, 158 | 778B412E205A116900992EA4 /* 小房子@2x.png */, 159 | 778B412F205A116900992EA4 /* 小房子@3x.png */, 160 | 778B412C205A116900992EA4 /* 小猫@2x.png */, 161 | 778B412D205A116900992EA4 /* 小猫@3x.png */, 162 | 778B412A205A116900992EA4 /* 邮件信息@2x.png */, 163 | 778B412B205A116900992EA4 /* 邮件信息@3x.png */, 164 | 778B4136205A12AB00992EA4 /* 默认icon@2x.png */, 165 | 778B4137205A12AB00992EA4 /* 默认icon@3x.png */, 166 | ); 167 | path = APPIcon; 168 | sourceTree = ""; 169 | }; 170 | 778B413C205A68B700992EA4 /* icon尺寸图 */ = { 171 | isa = PBXGroup; 172 | children = ( 173 | 77673AB7205BC88200C524EE /* MoreSizeViewController.swift */, 174 | 77673AB8205BC88200C524EE /* MoreSizeViewController.xib */, 175 | ); 176 | path = "icon尺寸图"; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXGroup section */ 180 | 181 | /* Begin PBXNativeTarget section */ 182 | 776A11E720594931008FA263 /* ChangeIcon */ = { 183 | isa = PBXNativeTarget; 184 | buildConfigurationList = 776A11FD20594931008FA263 /* Build configuration list for PBXNativeTarget "ChangeIcon" */; 185 | buildPhases = ( 186 | 776A11E420594931008FA263 /* Sources */, 187 | 776A11E520594931008FA263 /* Frameworks */, 188 | 776A11E620594931008FA263 /* Resources */, 189 | ); 190 | buildRules = ( 191 | ); 192 | dependencies = ( 193 | ); 194 | name = ChangeIcon; 195 | productName = ChangeIcon; 196 | productReference = 776A11E820594931008FA263 /* ChangeIcon.app */; 197 | productType = "com.apple.product-type.application"; 198 | }; 199 | /* End PBXNativeTarget section */ 200 | 201 | /* Begin PBXProject section */ 202 | 776A11E020594931008FA263 /* Project object */ = { 203 | isa = PBXProject; 204 | attributes = { 205 | LastSwiftUpdateCheck = 0920; 206 | LastUpgradeCheck = 0920; 207 | ORGANIZATIONNAME = quanjunt; 208 | TargetAttributes = { 209 | 776A11E720594931008FA263 = { 210 | CreatedOnToolsVersion = 9.2; 211 | ProvisioningStyle = Automatic; 212 | }; 213 | }; 214 | }; 215 | buildConfigurationList = 776A11E320594931008FA263 /* Build configuration list for PBXProject "ChangeIcon" */; 216 | compatibilityVersion = "Xcode 8.0"; 217 | developmentRegion = en; 218 | hasScannedForEncodings = 0; 219 | knownRegions = ( 220 | en, 221 | Base, 222 | ); 223 | mainGroup = 776A11DF20594931008FA263; 224 | productRefGroup = 776A11E920594931008FA263 /* Products */; 225 | projectDirPath = ""; 226 | projectRoot = ""; 227 | targets = ( 228 | 776A11E720594931008FA263 /* ChangeIcon */, 229 | ); 230 | }; 231 | /* End PBXProject section */ 232 | 233 | /* Begin PBXResourcesBuildPhase section */ 234 | 776A11E620594931008FA263 /* Resources */ = { 235 | isa = PBXResourcesBuildPhase; 236 | buildActionMask = 2147483647; 237 | files = ( 238 | 778B4139205A12AB00992EA4 /* 默认icon@3x.png in Resources */, 239 | 778B4134205A116900992EA4 /* 小房子@2x.png in Resources */, 240 | 778B4138205A12AB00992EA4 /* 默认icon@2x.png in Resources */, 241 | 778B4132205A116900992EA4 /* 小猫@2x.png in Resources */, 242 | 77673AC5205BCD8700C524EE /* Sunday40x40@3x.png in Resources */, 243 | 778B4135205A116900992EA4 /* 小房子@3x.png in Resources */, 244 | 778B4133205A116900992EA4 /* 小猫@3x.png in Resources */, 245 | 77673AC4205BCD8700C524EE /* Sunday40x40@2x.png in Resources */, 246 | 778B4128205A115800992EA4 /* 天天特价@2x.png in Resources */, 247 | 776A11F920594931008FA263 /* LaunchScreen.storyboard in Resources */, 248 | 77673AC6205BCD8700C524EE /* Sunday60x60@2x.png in Resources */, 249 | 77673ABA205BC88200C524EE /* MoreSizeViewController.xib in Resources */, 250 | 776A11F620594931008FA263 /* Assets.xcassets in Resources */, 251 | 77673AC2205BCD8700C524EE /* Sunday29x29@2x.png in Resources */, 252 | 778B4129205A115800992EA4 /* 天天特价@3x.png in Resources */, 253 | 776A11F120594931008FA263 /* Main.storyboard in Resources */, 254 | 77673AC7205BCD8700C524EE /* Sunday60x60@3x.png in Resources */, 255 | 778B4130205A116900992EA4 /* 邮件信息@2x.png in Resources */, 256 | 778B4131205A116900992EA4 /* 邮件信息@3x.png in Resources */, 257 | 776A120A20594CE0008FA263 /* NoAlertChangeViewController.xib in Resources */, 258 | 77673AC3205BCD8700C524EE /* Sunday29x29@3x.png in Resources */, 259 | 776A120620594CD3008FA263 /* AlertChangeViewController.xib in Resources */, 260 | ); 261 | runOnlyForDeploymentPostprocessing = 0; 262 | }; 263 | /* End PBXResourcesBuildPhase section */ 264 | 265 | /* Begin PBXSourcesBuildPhase section */ 266 | 776A11E420594931008FA263 /* Sources */ = { 267 | isa = PBXSourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | 776A11EE20594931008FA263 /* ViewController.swift in Sources */, 271 | 776A11EC20594931008FA263 /* AppDelegate.swift in Sources */, 272 | 77673AB9205BC88200C524EE /* MoreSizeViewController.swift in Sources */, 273 | 778B413B205A619700992EA4 /* Extension-Dispatch.swift in Sources */, 274 | 776A11F420594931008FA263 /* ChangeIcon.xcdatamodeld in Sources */, 275 | 776A120920594CE0008FA263 /* NoAlertChangeViewController.swift in Sources */, 276 | 776A120520594CD3008FA263 /* AlertChangeViewController.swift in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | /* End PBXSourcesBuildPhase section */ 281 | 282 | /* Begin PBXVariantGroup section */ 283 | 776A11EF20594931008FA263 /* Main.storyboard */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 776A11F020594931008FA263 /* Base */, 287 | ); 288 | name = Main.storyboard; 289 | sourceTree = ""; 290 | }; 291 | 776A11F720594931008FA263 /* LaunchScreen.storyboard */ = { 292 | isa = PBXVariantGroup; 293 | children = ( 294 | 776A11F820594931008FA263 /* Base */, 295 | ); 296 | name = LaunchScreen.storyboard; 297 | sourceTree = ""; 298 | }; 299 | /* End PBXVariantGroup section */ 300 | 301 | /* Begin XCBuildConfiguration section */ 302 | 776A11FB20594931008FA263 /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 308 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 309 | CLANG_CXX_LIBRARY = "libc++"; 310 | CLANG_ENABLE_MODULES = YES; 311 | CLANG_ENABLE_OBJC_ARC = YES; 312 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 313 | CLANG_WARN_BOOL_CONVERSION = YES; 314 | CLANG_WARN_COMMA = YES; 315 | CLANG_WARN_CONSTANT_CONVERSION = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 318 | CLANG_WARN_EMPTY_BODY = YES; 319 | CLANG_WARN_ENUM_CONVERSION = YES; 320 | CLANG_WARN_INFINITE_RECURSION = YES; 321 | CLANG_WARN_INT_CONVERSION = YES; 322 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 329 | CLANG_WARN_UNREACHABLE_CODE = YES; 330 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 331 | CODE_SIGN_IDENTITY = "iPhone Developer"; 332 | COPY_PHASE_STRIP = NO; 333 | DEBUG_INFORMATION_FORMAT = dwarf; 334 | ENABLE_STRICT_OBJC_MSGSEND = YES; 335 | ENABLE_TESTABILITY = YES; 336 | GCC_C_LANGUAGE_STANDARD = gnu11; 337 | GCC_DYNAMIC_NO_PIC = NO; 338 | GCC_NO_COMMON_BLOCKS = YES; 339 | GCC_OPTIMIZATION_LEVEL = 0; 340 | GCC_PREPROCESSOR_DEFINITIONS = ( 341 | "DEBUG=1", 342 | "$(inherited)", 343 | ); 344 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 345 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 346 | GCC_WARN_UNDECLARED_SELECTOR = YES; 347 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 348 | GCC_WARN_UNUSED_FUNCTION = YES; 349 | GCC_WARN_UNUSED_VARIABLE = YES; 350 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 351 | MTL_ENABLE_DEBUG_INFO = YES; 352 | ONLY_ACTIVE_ARCH = YES; 353 | SDKROOT = iphoneos; 354 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 355 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 356 | }; 357 | name = Debug; 358 | }; 359 | 776A11FC20594931008FA263 /* Release */ = { 360 | isa = XCBuildConfiguration; 361 | buildSettings = { 362 | ALWAYS_SEARCH_USER_PATHS = NO; 363 | CLANG_ANALYZER_NONNULL = YES; 364 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 365 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 366 | CLANG_CXX_LIBRARY = "libc++"; 367 | CLANG_ENABLE_MODULES = YES; 368 | CLANG_ENABLE_OBJC_ARC = YES; 369 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 370 | CLANG_WARN_BOOL_CONVERSION = YES; 371 | CLANG_WARN_COMMA = YES; 372 | CLANG_WARN_CONSTANT_CONVERSION = YES; 373 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 374 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 375 | CLANG_WARN_EMPTY_BODY = YES; 376 | CLANG_WARN_ENUM_CONVERSION = YES; 377 | CLANG_WARN_INFINITE_RECURSION = YES; 378 | CLANG_WARN_INT_CONVERSION = YES; 379 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 380 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 381 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 382 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 383 | CLANG_WARN_STRICT_PROTOTYPES = YES; 384 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 385 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 386 | CLANG_WARN_UNREACHABLE_CODE = YES; 387 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 388 | CODE_SIGN_IDENTITY = "iPhone Developer"; 389 | COPY_PHASE_STRIP = NO; 390 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 391 | ENABLE_NS_ASSERTIONS = NO; 392 | ENABLE_STRICT_OBJC_MSGSEND = YES; 393 | GCC_C_LANGUAGE_STANDARD = gnu11; 394 | GCC_NO_COMMON_BLOCKS = YES; 395 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 396 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 397 | GCC_WARN_UNDECLARED_SELECTOR = YES; 398 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 399 | GCC_WARN_UNUSED_FUNCTION = YES; 400 | GCC_WARN_UNUSED_VARIABLE = YES; 401 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 402 | MTL_ENABLE_DEBUG_INFO = NO; 403 | SDKROOT = iphoneos; 404 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 405 | VALIDATE_PRODUCT = YES; 406 | }; 407 | name = Release; 408 | }; 409 | 776A11FE20594931008FA263 /* Debug */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | CODE_SIGN_STYLE = Automatic; 414 | DEVELOPMENT_TEAM = 3HG8J7L5X5; 415 | INFOPLIST_FILE = ChangeIcon/Info.plist; 416 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 417 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 418 | PRODUCT_BUNDLE_IDENTIFIER = com.quanjunt.www.ChangeIcon; 419 | PRODUCT_NAME = "$(TARGET_NAME)"; 420 | SWIFT_VERSION = 4.0; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | 776A11FF20594931008FA263 /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 429 | CODE_SIGN_STYLE = Automatic; 430 | DEVELOPMENT_TEAM = 3HG8J7L5X5; 431 | INFOPLIST_FILE = ChangeIcon/Info.plist; 432 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 433 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 434 | PRODUCT_BUNDLE_IDENTIFIER = com.quanjunt.www.ChangeIcon; 435 | PRODUCT_NAME = "$(TARGET_NAME)"; 436 | SWIFT_VERSION = 4.0; 437 | TARGETED_DEVICE_FAMILY = "1,2"; 438 | }; 439 | name = Release; 440 | }; 441 | /* End XCBuildConfiguration section */ 442 | 443 | /* Begin XCConfigurationList section */ 444 | 776A11E320594931008FA263 /* Build configuration list for PBXProject "ChangeIcon" */ = { 445 | isa = XCConfigurationList; 446 | buildConfigurations = ( 447 | 776A11FB20594931008FA263 /* Debug */, 448 | 776A11FC20594931008FA263 /* Release */, 449 | ); 450 | defaultConfigurationIsVisible = 0; 451 | defaultConfigurationName = Release; 452 | }; 453 | 776A11FD20594931008FA263 /* Build configuration list for PBXNativeTarget "ChangeIcon" */ = { 454 | isa = XCConfigurationList; 455 | buildConfigurations = ( 456 | 776A11FE20594931008FA263 /* Debug */, 457 | 776A11FF20594931008FA263 /* Release */, 458 | ); 459 | defaultConfigurationIsVisible = 0; 460 | defaultConfigurationName = Release; 461 | }; 462 | /* End XCConfigurationList section */ 463 | 464 | /* Begin XCVersionGroup section */ 465 | 776A11F220594931008FA263 /* ChangeIcon.xcdatamodeld */ = { 466 | isa = XCVersionGroup; 467 | children = ( 468 | 776A11F320594931008FA263 /* ChangeIcon.xcdatamodel */, 469 | ); 470 | currentVersion = 776A11F320594931008FA263 /* ChangeIcon.xcdatamodel */; 471 | path = ChangeIcon.xcdatamodeld; 472 | sourceTree = ""; 473 | versionGroupType = wrapper.xcdatamodel; 474 | }; 475 | /* End XCVersionGroup section */ 476 | }; 477 | rootObject = 776A11E020594931008FA263 /* Project object */; 478 | } 479 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday29x29@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday29x29@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday40x40@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday40x40@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday60x60@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/Sunday/Sunday60x60@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/天天特价@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/天天特价@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/天天特价@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/天天特价@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/小房子@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/小房子@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/小房子@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/小房子@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/小猫@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/小猫@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/小猫@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/小猫@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/邮件信息@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/邮件信息@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/邮件信息@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/邮件信息@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/默认icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/默认icon@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/APPIcon/默认icon@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/APPIcon/默认icon@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // ChangeIcon 4 | // 5 | // Created by quanjunt on 2018/3/14. 6 | // Copyright © 2018年 quanjunt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import CoreData 11 | 12 | var Uploadimagecount = 0 13 | 14 | @UIApplicationMain 15 | class AppDelegate: UIResponder, UIApplicationDelegate { 16 | 17 | var window: UIWindow? 18 | 19 | 20 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 21 | 22 | UIApplication.shared.registerUserNotificationSettings(UIUserNotificationSettings(types: [.badge, .sound], categories: nil)) 23 | 24 | UIViewController.runtimeReplaceAlert() 25 | 26 | return true 27 | } 28 | 29 | 30 | } 31 | 32 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小房子.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "小房子@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "小房子@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小房子.imageset/小房子@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小房子.imageset/小房子@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小房子.imageset/小房子@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小房子.imageset/小房子@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小猫.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "小猫@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "小猫@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小猫.imageset/小猫@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小猫.imageset/小猫@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小猫.imageset/小猫@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/APPIcon/小猫.imageset/小猫@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-40.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-60.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-29@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-29@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-40@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-60@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "1024x1024", 53 | "idiom" : "ios-marketing", 54 | "filename" : "icon1024.jpg", 55 | "scale" : "1x" 56 | } 57 | ], 58 | "info" : { 59 | "version" : 1, 60 | "author" : "xcode" 61 | } 62 | } -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-29@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-29@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-40.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-60.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/icon1024.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/AppIcon.appiconset/icon1024.jpg -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/邮件信息.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "邮件信息@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "filename" : "邮件信息@3x.png", 15 | "scale" : "3x" 16 | } 17 | ], 18 | "info" : { 19 | "version" : 1, 20 | "author" : "xcode" 21 | } 22 | } -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/邮件信息.imageset/邮件信息@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/邮件信息.imageset/邮件信息@2x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Assets.xcassets/邮件信息.imageset/邮件信息@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CoderTitan/ChangeIcon/eb8ca30df93ac58bb5b22fa165977bd6c2260eed/ChangeIcon/ChangeIcon/Assets.xcassets/邮件信息.imageset/邮件信息@3x.png -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/ChangeIcon.xcdatamodeld/.xccurrentversion: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | _XCCurrentVersionName 6 | ChangeIcon.xcdatamodel 7 | 8 | 9 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/ChangeIcon.xcdatamodeld/ChangeIcon.xcdatamodel/contents: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIcons 6 | 7 | CFBundlePrimaryIcon 8 | 9 | CFBundleIconFiles 10 | 11 | 默认icon 12 | 13 | 14 | CFBundleAlternateIcons 15 | 16 | Sunday 17 | 18 | UIPrerenderedIcon 19 | 20 | CFBundleIconFiles 21 | 22 | Sunday60x60 23 | Sunday40x40 24 | Sunday29x29 25 | 26 | 27 | 天天特价 28 | 29 | CFBundleIconFiles 30 | 31 | 天天特价 32 | 33 | UIPrerenderedIcon 34 | 35 | 36 | 小房子 37 | 38 | CFBundleIconFiles 39 | 40 | 小房子 41 | 42 | UIPrerenderedIcon 43 | 44 | 45 | 小猫 46 | 47 | CFBundleIconFiles 48 | 49 | 小猫 50 | 51 | UIPrerenderedIcon 52 | 53 | 54 | 邮件信息 55 | 56 | CFBundleIconFiles 57 | 58 | 邮件信息 59 | 60 | UIPrerenderedIcon 61 | 62 | 63 | 64 | 65 | NSAppTransportSecurity 66 | 67 | NSAllowsArbitraryLoads 68 | 69 | 70 | CFBundleDevelopmentRegion 71 | $(DEVELOPMENT_LANGUAGE) 72 | CFBundleExecutable 73 | $(EXECUTABLE_NAME) 74 | CFBundleIdentifier 75 | $(PRODUCT_BUNDLE_IDENTIFIER) 76 | CFBundleInfoDictionaryVersion 77 | 6.0 78 | CFBundleName 79 | $(PRODUCT_NAME) 80 | CFBundlePackageType 81 | APPL 82 | CFBundleShortVersionString 83 | 1.0 84 | CFBundleVersion 85 | 1 86 | LSRequiresIPhoneOS 87 | 88 | UILaunchStoryboardName 89 | LaunchScreen 90 | UIMainStoryboardFile 91 | Main 92 | UIRequiredDeviceCapabilities 93 | 94 | armv7 95 | 96 | UISupportedInterfaceOrientations 97 | 98 | UIInterfaceOrientationPortrait 99 | UIInterfaceOrientationLandscapeLeft 100 | UIInterfaceOrientationLandscapeRight 101 | 102 | UISupportedInterfaceOrientations~ipad 103 | 104 | UIInterfaceOrientationPortrait 105 | UIInterfaceOrientationPortraitUpsideDown 106 | UIInterfaceOrientationLandscapeLeft 107 | UIInterfaceOrientationLandscapeRight 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // ChangeIcon 4 | // 5 | // Created by quanjunt on 2018/3/14. 6 | // Copyright © 2018年 quanjunt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak var tableView: UITableView! 14 | fileprivate var titleArr = ["弹框提示更换icon", "无弹框提示更换icon", "多尺寸图标更换"] 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | title = "列表" 19 | } 20 | } 21 | 22 | extension ViewController: UITableViewDataSource, UITableViewDelegate { 23 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 24 | return titleArr.count 25 | } 26 | 27 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 28 | var cell = tableView.dequeueReusableCell(withIdentifier: "cell") 29 | if cell == nil { 30 | cell = UITableViewCell(style: .default, reuseIdentifier: "cell") 31 | } 32 | cell?.selectionStyle = .none 33 | cell?.textLabel?.text = titleArr[indexPath.row] 34 | return cell! 35 | } 36 | 37 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 38 | let vcs = [AlertChangeViewController(), NoAlertChangeViewController(), MoreSizeViewController()] 39 | let vc = vcs[indexPath.row] 40 | vc.title = titleArr[indexPath.row] 41 | navigationController?.pushViewController(vc, animated: true) 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/icon尺寸图/MoreSizeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MoreSizeViewController.swift 3 | // ChangeIcon 4 | // 5 | // Created by quanjunt on 2018/3/16. 6 | // Copyright © 2018年 quanjunt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class MoreSizeViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | } 17 | 18 | @IBAction func moreSizeChangeAction(_ sender: Any) { 19 | //判断是否支持替换图标, false: 不支持 20 | if #available(iOS 10.3, *) { 21 | //判断是否支持替换图标, false: 不支持 22 | guard UIApplication.shared.supportsAlternateIcons else { return } 23 | 24 | //如果支持, 替换icon 25 | UIApplication.shared.setAlternateIconName("Sunday") { (error) in 26 | //点击弹框的确认按钮后的回调 27 | if error != nil { 28 | print(error ?? "更换icon发生错误") 29 | } else { 30 | print("更换成功") 31 | } 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/icon尺寸图/MoreSizeViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/无弹框/Extension-Dispatch.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Extension-Dispatch.swift 3 | // ChangeIcon 4 | // 5 | // Created by quanjunt on 2018/3/15. 6 | // Copyright © 2018年 quanjunt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension DispatchQueue { 12 | private static var _onceTracker = [String]() 13 | public class func once(token: String, block: () -> ()) { 14 | objc_sync_enter(self) 15 | defer { 16 | objc_sync_exit(self) 17 | } 18 | if _onceTracker.contains(token) { 19 | return 20 | } 21 | _onceTracker.append(token) 22 | block() 23 | } 24 | 25 | func async(block: @escaping ()->()) { 26 | self.async(execute: block) 27 | } 28 | 29 | func after(time: DispatchTime, block: @escaping ()->()) { 30 | self.asyncAfter(deadline: time, execute: block) 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/无弹框/NoAlertChangeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NoAlertChangeViewController.swift 3 | // ChangeIcon 4 | // 5 | // Created by quanjunt on 2018/3/14. 6 | // Copyright © 2018年 quanjunt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | fileprivate let row = 4 //列 13 | fileprivate let imageW = (UIScreen.main.bounds.width - (CGFloat(row) + 1) * 20) / CGFloat(row) 14 | class NoAlertChangeViewController: UIViewController { 15 | 16 | fileprivate var imageArr = ["天天特价", "小房子", "小猫", "邮件信息"] 17 | // fileprivate var index = 0 18 | fileprivate lazy var selectorlabel = { () -> UILabel in 19 | let label = UILabel() 20 | label.backgroundColor = UIColor.red 21 | label.text = "选中" 22 | label.textAlignment = .center 23 | label.textColor = UIColor.white 24 | view.addSubview(label) 25 | return label 26 | }() 27 | 28 | 29 | override func viewDidLoad() { 30 | super.viewDidLoad() 31 | 32 | title = "点击下图更换icon图" 33 | 34 | //这里更换方法之后, 也会影响到其他vc 35 | setupViews() 36 | } 37 | 38 | //创建页面视图 39 | fileprivate func setupViews() { 40 | 41 | for i in 0.. Swift.Void)? = nil) { 107 | //判断是否是alert弹窗 108 | if viewControllerToPresent.isKind(of: UIAlertController.self) { 109 | print("title: \(String(describing: (viewControllerToPresent as? UIAlertController)?.title))") 110 | print("message: \(String(describing: (viewControllerToPresent as? UIAlertController)?.message))") 111 | 112 | // 换图标时的提示框的title和message都是nil,由此可特殊处理 113 | let alertController = viewControllerToPresent as? UIAlertController 114 | if alertController?.title == nil && alertController?.message == nil { 115 | //是更换icon的提示 116 | changeAction() 117 | return 118 | } else { 119 | //其他的弹框提示正常处理 120 | noAlert_present(viewControllerToPresent, animated: flag, completion: completion) 121 | } 122 | } 123 | noAlert_present(viewControllerToPresent, animated: flag, completion: completion) 124 | } 125 | 126 | func changeAction(){ 127 | print("替换成功") 128 | print(Uploadimagecount) 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/无弹框/NoAlertChangeViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/有弹框/AlertChangeViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AlertChangeViewController.swift 3 | // ChangeIcon 4 | // 5 | // Created by quanjunt on 2018/3/14. 6 | // Copyright © 2018年 quanjunt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AlertChangeViewController: UIViewController { 12 | 13 | fileprivate var imageArr = ["天天特价", "小房子", "小猫", "邮件信息"] 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | 18 | // Do any additional setup after loading the view. 19 | } 20 | 21 | 22 | //更换Icon图 23 | @IBAction func changeIconAction(_ sender: Any) { 24 | let imageStr = imageArr[Int(arc4random_uniform(UInt32(imageArr.count)))] 25 | 26 | //判断是否支持替换图标, false: 不支持 27 | if #available(iOS 10.3, *) { 28 | //判断是否支持替换图标, false: 不支持 29 | guard UIApplication.shared.supportsAlternateIcons else { return } 30 | 31 | //如果支持, 替换icon 32 | UIApplication.shared.setAlternateIconName(imageStr) { (error) in 33 | //点击弹框的确认按钮后的回调 34 | if error != nil { 35 | print(error ?? "更换icon发生错误") 36 | } else { 37 | print("更换成功") 38 | } 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ChangeIcon/ChangeIcon/有弹框/AlertChangeViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 CoderTitan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, 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, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # iOS神技之动态更换APP的Icon图 2 | 3 | - 在iOS10.3系统发布之前, 众所周知, 在App Store上架的APP如果要更换Icon图, 只能更新版本替换; 4 | - 这次苹果却在iOS10.3系统中加入了了更换应用图标的新功能,当应用安装后,开发者可以为应用提供多个应用图标选择。 5 | - 用户可以自由的在这些图标之间切换,并及时生效。 6 | - 这是因为 10.3 里引入了一个新的 API,它允许在 App 运行的时候,通过代码为 app 更换 icon 7 | - 个人技术博客地址: https://www.titanjun.top/ 8 | 9 | 10 | 11 | ## 一. 项目配置 12 | 13 | - 虽然提供了更换的功能,但更换的 icon 是有限制的 14 | - 它只能更换项目中提前添加配置好的Icon图 15 | - 具体可参考demo--[github项目地址](https://github.com/CoderTitan/ChangeIcon) 16 | 17 | - 这里先看个效果 18 | 19 | 20 | ![更换icon.gif](https://upload-images.jianshu.io/upload_images/4122543-66b9c476748f1937.gif?imageMogr2/auto-orient/strip) 21 | 22 | 23 | ### 1. 备选Icon 24 | - 首先你需要将备选的Icon图添加到项目中, 25 | - 注意: 26 | - 图片不要放到`Assets.xcassets`, 而应该直接放到工程中, 不然可能导致更换Icon时, 找不到图片, 更换失败 27 | - 在`info.plist` 的配置中,图片的文件名应该尽量不带 @2x/@3x 后缀扩展名,而让它自动选择 28 | 29 | ![Snip20180315_1.png](https://upload-images.jianshu.io/upload_images/4122543-49f0f45c2657a229.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600) 30 | 31 | ### 2. 配置`info.plist`文件 32 | - 在`info.plist`文件中,添加对应的`CFBundleAlternateIcons`的信息 33 | - 这里也可以查看[官方的相关介绍](https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009247) 34 | 35 | ![Snip20180315_2.png](https://upload-images.jianshu.io/upload_images/4122543-8886cf5e071a1c59.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600) 36 | 37 | 38 | > `Source Code`添加方式如下 39 | 40 | 41 | ```objc 42 | CFBundleAlternateIcons 43 | 44 | 天天特价 45 | 46 | CFBundleIconFiles 47 | 48 | 天天特价 49 | 50 | UIPrerenderedIcon 51 | 52 | 53 | 小房子 54 | 55 | CFBundleIconFiles 56 | 57 | 小房子 58 | 59 | UIPrerenderedIcon 60 | 61 | 62 | 小猫 63 | 64 | CFBundleIconFiles 65 | 66 | 小猫 67 | 68 | UIPrerenderedIcon 69 | 70 | 71 | 邮件信息 72 | 73 | CFBundleIconFiles 74 | 75 | 邮件信息 76 | 77 | UIPrerenderedIcon 78 | 79 | 80 | 81 | 82 | ``` 83 | 84 | - 注意事项: 85 | - 虽然文档中写着`「You must declare your app's primary and alternate icons using the CFBundleIcons key of your app's Info.plist file. 」`,但经测试,`CFBundlePrimaryIcon` 可以省略掉。在工程配置 `App Icons and Launch Image` - `App Icons Source` 中使用 `asset catalog`(默认配置),删除 `CFBundlePrimaryIcon` 的配置也是没有问题的。 86 | - 省略这个配置的好处是,避免处理 `App icon` 的尺寸。现在的工程中,大家一般都使用 `asset catalog` 进行 icon 的配置,而一个 icon 对应有很多尺寸的文件。省略 `CFBundlePrimaryIcon` 就可以沿用 `Asset` 中的配置。 87 | - 如果想设置回默认 icon,在 `setAlternateIconName` 中传入 nil 即可 88 | 89 | 90 | ## 二. API调用 91 | 下面我们看一下系统提供的三个API, 这里产看[官方文档](https://developer.apple.com/documentation/uikit/uiapplication/2806818-setalternateiconname) 92 | 93 | 94 | ```objc 95 | var supportsAlternateIcons: Bool 96 | //一个布尔值,指示是否允许应用程序更改其图标 97 | 98 | var alternateIconName: String? 99 | //可选图标的名称,在app的Info.plist文件中声明的CFBundleAlternateIcons中设置。 100 | //如果要显示应用程序的主图标alternateIconName 传nil即可,主图标使用CFBundlePrimaryIcon声明,CFBundleAlternateIcons与CFBundlePrimaryIcon两个key都是CFBundleIcons的子条目 101 | 102 | func setAlternateIconName(_ alternateIconName: String?, 103 | completionHandler: ((Error?) -> Void)? = nil) 104 | //更改应用程序的图标 105 | //completionHandler: 当有结果的时候的回调 106 | //成功改变图标的的时候,error为nil,如果发生错误,error描述发生什么了。并且alternateIconName的值保持不变 107 | ``` 108 | 109 | 具体的实现代码: 110 | 111 | ```objc 112 | if #available(iOS 10.3, *) { 113 | //判断是否支持替换图标, false: 不支持 114 | guard UIApplication.shared.supportsAlternateIcons else { return } 115 | 116 | //如果支持, 替换icon 117 | UIApplication.shared.setAlternateIconName(imageStr) { (error) in 118 | if error != nil { 119 | print(error ?? "更换icon发生错误") 120 | } else { 121 | print("更换成功") 122 | } 123 | } 124 | } 125 | 126 | ``` 127 | 128 | ## 三. 消除alert弹窗 129 | 130 | ![Snip20180315_3.png](https://upload-images.jianshu.io/upload_images/4122543-8ffa3280a84c46ed.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/600) 131 | 132 | 133 | - 动态更换App图标会有弹框, 有时候这个弹框看上去可能会很别扭, 但是这个弹框是系统直接调用弹出的, 我们又如何消除呢 134 | - 通过层级关系可以看到这个弹框就是一个`UIAlertController`, 并且是通过`presentViewController:animated:completion:`方法弹出的 135 | - 所以可以考虑使用`runtime`, 拦截并替换该方法, 让更换icon的时候, 不弹 136 | - 下面看一下具体代码: 137 | 138 | 139 | ```objc 140 | extension NoAlertChangeViewController { 141 | fileprivate func runtimeReplaceAlert() { 142 | DispatchQueue.once(token: "UIAlertController") { 143 | let originalSelector = #selector(present(_:animated:completion:)) 144 | let swizzledSelector = #selector(noAlert_present(_:animated:completion:)) 145 | 146 | let originalMethod = class_getInstanceMethod(NoAlertChangeViewController.self, originalSelector) 147 | let swizzledMethod = class_getInstanceMethod(NoAlertChangeViewController.self, swizzledSelector) 148 | 149 | //交换实现的方法 150 | method_exchangeImplementations(originalMethod!, swizzledMethod!) 151 | } 152 | } 153 | 154 | @objc fileprivate func noAlert_present(_ viewControllerToPresent: UIViewController, animated flag: Bool, completion: (() -> Swift.Void)? = nil) { 155 | //判断是否是alert弹窗 156 | if viewControllerToPresent.isKind(of: UIAlertController.self) { 157 | print("title: \(String(describing: (viewControllerToPresent as? UIAlertController)?.title))") 158 | print("message: \(String(describing: (viewControllerToPresent as? UIAlertController)?.message))") 159 | 160 | // 换图标时的提示框的title和message都是nil,由此可特殊处理 161 | let alertController = viewControllerToPresent as? UIAlertController 162 | if alertController?.title == nil && alertController?.message == nil { 163 | //是更换icon的提示 164 | return 165 | } else { 166 | //其他的弹框提示正常处理 167 | noAlert_present(viewControllerToPresent, animated: flag, completion: completion) 168 | } 169 | } 170 | noAlert_present(viewControllerToPresent, animated: flag, completion: completion) 171 | } 172 | } 173 | 174 | ``` 175 | 176 | - 这里用到了`DispatchQueue.once`, 这个`once`是我对`DispatchQueue`加了一个扩展 177 | - 在Swift4.0以后, `static dispatch_once_t onceToken;`这个已经不能用了 178 | - 关于这方面的详细介绍, 大家可以看看我的这篇文章--[升级Swift4.0遇到的坑](https://www.titanjun.top/2017/08/25/%E5%8D%87%E7%BA%A7Swift4.0%E9%81%87%E5%88%B0%E7%9A%84%E5%9D%91/) 179 | - 180 | 181 | ## 四. 支持不同尺寸的Icon 182 | - 一个标准的Icon图集, 需要十几种尺寸, 比如: 20, 29, 40, 60等 183 | - 对于 `info.plist` 中的每个 `icon` 配置,`CFBundleIconFiles` 的值是一个数组,我们可以在其中填入这十几种规格的图片名称。经测试: 184 | - 文件的命名没有强制的规则,可以随意取, 185 | - 数组中的文件名也不关心先后顺序。 186 | - 总之把对应的文件名填进去即可,它会自动选择合适分辨率的文件(比如在 setting 中显示 icon 时,它会找到提供的数组中分辨率为 29pt 的那个文件)。 187 | - 具体相关官方文档可参考, [官方介绍](https://developer.apple.com/ios/human-interface-guidelines/overview/themes/#app-icon-sizes) 188 | - 首先, 针对不同的尺寸, 我们要有不同的命名, 具体参考下图 189 | 190 | ![不同尺寸图片配置图](http://img.blog.csdn.net/20180316194726671?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvU2htaWx5Q29kZXI=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast) 191 | 192 | - 文件扩展名,如@2x,@3x,要么统一不写,那么系统会自动寻找合适的尺寸。 193 | - 要写就需要把每张icon的扩展名写上,和上图的格式一样 194 | - 代码中调用图片名, 更不需要加上尺寸: 195 | 196 | ```objc 197 | if #available(iOS 10.3, *) { 198 | //判断是否支持替换图标, false: 不支持 199 | guard UIApplication.shared.supportsAlternateIcons else { return } 200 | 201 | //如果支持, 替换icon 202 | UIApplication.shared.setAlternateIconName("Sunday") { (error) in 203 | //点击弹框的确认按钮后的回调 204 | if error != nil { 205 | print(error ?? "更换icon发生错误") 206 | } else { 207 | print("更换成功") 208 | } 209 | } 210 | } 211 | 212 | ``` 213 | 214 | - 具体可参考demo--[github项目地址](https://github.com/CoderTitan/ChangeIcon) 215 | 216 | 217 | 218 | --------------------------------------------------------------------------------