├── BeginCLLocationOC ├── Pods │ ├── Headers │ │ ├── Private │ │ │ └── MBProgressHUD │ │ │ │ └── MBProgressHUD.h │ │ └── Public │ │ │ └── MBProgressHUD │ │ │ └── MBProgressHUD.h │ ├── Target Support Files │ │ ├── Pods-MBProgressHUD │ │ │ ├── Pods-MBProgressHUD.xcconfig │ │ │ ├── Pods-MBProgressHUD-prefix.pch │ │ │ ├── Pods-MBProgressHUD-dummy.m │ │ │ └── Pods-MBProgressHUD-Private.xcconfig │ │ └── Pods │ │ │ ├── Pods-dummy.m │ │ │ ├── Pods.debug.xcconfig │ │ │ ├── Pods.release.xcconfig │ │ │ ├── Pods-environment.h │ │ │ ├── Pods-acknowledgements.markdown │ │ │ ├── Pods-acknowledgements.plist │ │ │ └── Pods-resources.sh │ ├── Manifest.lock │ ├── MBProgressHUD │ │ ├── LICENSE │ │ ├── README.mdown │ │ ├── MBProgressHUD.h │ │ └── MBProgressHUD.m │ └── Pods.xcodeproj │ │ └── project.pbxproj ├── Podfile ├── BeginCLLocationOC.xcworkspace │ ├── xcuserdata │ │ └── wamaker.xcuserdatad │ │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── UserInterfaceState.xcuserstate │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── BeginCLLocationOC.xccheckout ├── Podfile.lock ├── BeginCLLocationOC.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcuserdata │ │ │ └── wamaker.xcuserdatad │ │ │ │ └── UserInterfaceState.xcuserstate │ │ └── xcshareddata │ │ │ └── BeginCLLocationOC.xccheckout │ └── project.pbxproj ├── BeginCLLocationOC │ ├── ViewController.h │ ├── AppDelegate.h │ ├── main.m │ ├── Images.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Info.plist │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ └── ViewController.m └── BeginCLLocationOCTests │ ├── Info.plist │ └── BeginCLLocationOCTests.m ├── snapshot └── Core Location demo.gif └── README.md /BeginCLLocationOC/Pods/Headers/Private/MBProgressHUD/MBProgressHUD.h: -------------------------------------------------------------------------------- 1 | ../../../MBProgressHUD/MBProgressHUD.h -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Headers/Public/MBProgressHUD/MBProgressHUD.h: -------------------------------------------------------------------------------- 1 | ../../../MBProgressHUD/MBProgressHUD.h -------------------------------------------------------------------------------- /BeginCLLocationOC/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, "7.0" 2 | inhibit_all_warnings! 3 | 4 | pod 'MBProgressHUD', '~> 0.9.1' -------------------------------------------------------------------------------- /snapshot/Core Location demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WAMaker/BeginCLLocation-Repo/HEAD/snapshot/Core Location demo.gif -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods-MBProgressHUD/Pods-MBProgressHUD.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_MBPROGRESSHUD_OTHER_LDFLAGS = -framework "CoreGraphics" -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods-MBProgressHUD/Pods-MBProgressHUD-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC.xcworkspace/xcuserdata/wamaker.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MBProgressHUD (0.9.1) 3 | 4 | DEPENDENCIES: 5 | - MBProgressHUD (~> 0.9.1) 6 | 7 | SPEC CHECKSUMS: 8 | MBProgressHUD: c47f2c166c126cf2ce36498d80f33e754d4e93ad 9 | 10 | COCOAPODS: 0.37.2 11 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods-MBProgressHUD/Pods-MBProgressHUD-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_MBProgressHUD : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_MBProgressHUD 5 | @end 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BeginCLLocation-Repo 2 | Core Location初心者代码仓库 3 | 4 | 文章[戳这里](http://wamaker.me/2015/08/07/Core%20Location初心者/) 5 | 6 | 程序演示 7 | 8 | ![](https://github.com/WAMaker/BeginCLLocation-Repo/blob/master/snapshot/Core%20Location%20demo.gif) 9 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - MBProgressHUD (0.9.1) 3 | 4 | DEPENDENCIES: 5 | - MBProgressHUD (~> 0.9.1) 6 | 7 | SPEC CHECKSUMS: 8 | MBProgressHUD: c47f2c166c126cf2ce36498d80f33e754d4e93ad 9 | 10 | COCOAPODS: 0.37.2 11 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC.xcworkspace/xcuserdata/wamaker.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WAMaker/BeginCLLocation-Repo/HEAD/BeginCLLocationOC/BeginCLLocationOC.xcworkspace/xcuserdata/wamaker.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC.xcodeproj/project.xcworkspace/xcuserdata/wamaker.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WAMaker/BeginCLLocation-Repo/HEAD/BeginCLLocationOC/BeginCLLocationOC.xcodeproj/project.xcworkspace/xcuserdata/wamaker.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // BeginCLLocationOC 4 | // 5 | // Created by wamaker on 15/8/5. 6 | // Copyright (c) 2015年 wamaker. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ViewController : UIViewController 12 | 13 | @end 14 | 15 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // BeginCLLocationOC 4 | // 5 | // Created by wamaker on 15/8/5. 6 | // Copyright (c) 2015年 wamaker. 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 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // BeginCLLocationOC 4 | // 5 | // Created by wamaker on 15/8/5. 6 | // Copyright (c) 2015年 wamaker. 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 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods-MBProgressHUD/Pods-MBProgressHUD-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-MBProgressHUD.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/MBProgressHUD" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MBProgressHUD" 4 | OTHER_LDFLAGS = ${PODS_MBPROGRESSHUD_OTHER_LDFLAGS} -ObjC 5 | PODS_ROOT = ${SRCROOT} 6 | SKIP_INSTALL = YES -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods/Pods.debug.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MBProgressHUD" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/MBProgressHUD" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-MBProgressHUD" -framework "CoreGraphics" 5 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods/Pods.release.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/MBProgressHUD" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/MBProgressHUD" 4 | OTHER_LDFLAGS = $(inherited) -ObjC -l"Pods-MBProgressHUD" -framework "CoreGraphics" 5 | OTHER_LIBTOOLFLAGS = $(OTHER_LDFLAGS) 6 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods/Pods-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // MBProgressHUD 10 | #define COCOAPODS_POD_AVAILABLE_MBProgressHUD 11 | #define COCOAPODS_VERSION_MAJOR_MBProgressHUD 0 12 | #define COCOAPODS_VERSION_MINOR_MBProgressHUD 9 13 | #define COCOAPODS_VERSION_PATCH_MBProgressHUD 1 14 | 15 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOCTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOCTests/BeginCLLocationOCTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // BeginCLLocationOCTests.m 3 | // BeginCLLocationOCTests 4 | // 5 | // Created by wamaker on 15/8/5. 6 | // Copyright (c) 2015年 wamaker. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface BeginCLLocationOCTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation BeginCLLocationOCTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/MBProgressHUD/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2015 Matej Bukovinski 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods/Pods-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## MBProgressHUD 5 | 6 | Copyright (c) 2009-2015 Matej Bukovinski 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | Generated by CocoaPods - http://cocoapods.org 26 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 定位请求 41 | 42 | 43 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC.xcworkspace/xcshareddata/BeginCLLocationOC.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | B748E278-58ED-43D2-82CF-DE86310327AE 9 | IDESourceControlProjectName 10 | BeginCLLocationOC 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | E4CFD2F1BBFB424CA99A190A8EF04E68B108D672 14 | https://github.com/WAMaker/BeginCLLocation-Repo.git 15 | 16 | IDESourceControlProjectPath 17 | BeginCLLocationOC/BeginCLLocationOC.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | E4CFD2F1BBFB424CA99A190A8EF04E68B108D672 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/WAMaker/BeginCLLocation-Repo.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | E4CFD2F1BBFB424CA99A190A8EF04E68B108D672 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | E4CFD2F1BBFB424CA99A190A8EF04E68B108D672 36 | IDESourceControlWCCName 37 | BeginCLLocation-Repo 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC.xcodeproj/project.xcworkspace/xcshareddata/BeginCLLocationOC.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 79FB3E68-C3F0-4A7E-BDCE-4C4D1FBD386F 9 | IDESourceControlProjectName 10 | BeginCLLocationOC 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | E4CFD2F1BBFB424CA99A190A8EF04E68B108D672 14 | https://github.com/WAMaker/BeginCLLocation-Repo.git 15 | 16 | IDESourceControlProjectPath 17 | BeginCLLocationOC/BeginCLLocationOC.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | E4CFD2F1BBFB424CA99A190A8EF04E68B108D672 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/WAMaker/BeginCLLocation-Repo.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | E4CFD2F1BBFB424CA99A190A8EF04E68B108D672 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | E4CFD2F1BBFB424CA99A190A8EF04E68B108D672 36 | IDESourceControlWCCName 37 | BeginCLLocation-Repo 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // BeginCLLocationOC 4 | // 5 | // Created by wamaker on 15/8/5. 6 | // Copyright (c) 2015年 wamaker. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods/Pods-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | Copyright (c) 2009-2015 Matej Bukovinski 18 | 19 | Permission is hereby granted, free of charge, to any person obtaining a copy 20 | of this software and associated documentation files (the "Software"), to deal 21 | in the Software without restriction, including without limitation the rights 22 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 23 | copies of the Software, and to permit persons to whom the Software is 24 | furnished to do so, subject to the following conditions: 25 | 26 | The above copyright notice and this permission notice shall be included in 27 | all copies or substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 35 | THE SOFTWARE. 36 | Title 37 | MBProgressHUD 38 | Type 39 | PSGroupSpecifier 40 | 41 | 42 | FooterText 43 | Generated by CocoaPods - http://cocoapods.org 44 | Title 45 | 46 | Type 47 | PSGroupSpecifier 48 | 49 | 50 | StringsTable 51 | Acknowledgements 52 | Title 53 | Acknowledgements 54 | 55 | 56 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Target Support Files/Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 5 | 6 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 7 | > "$RESOURCES_TO_COPY" 8 | 9 | XCASSET_FILES=() 10 | 11 | realpath() { 12 | DIRECTORY=$(cd "${1%/*}" && pwd) 13 | FILENAME="${1##*/}" 14 | echo "$DIRECTORY/$FILENAME" 15 | } 16 | 17 | install_resource() 18 | { 19 | case $1 in 20 | *.storyboard) 21 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 22 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 23 | ;; 24 | *.xib) 25 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 26 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 27 | ;; 28 | *.framework) 29 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 30 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 31 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 32 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 33 | ;; 34 | *.xcdatamodel) 35 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 36 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 37 | ;; 38 | *.xcdatamodeld) 39 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 40 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 41 | ;; 42 | *.xcmappingmodel) 43 | echo "xcrun mapc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm\"" 44 | xcrun mapc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcmappingmodel`.cdm" 45 | ;; 46 | *.xcassets) 47 | ABSOLUTE_XCASSET_FILE=$(realpath "${PODS_ROOT}/$1") 48 | XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") 49 | ;; 50 | /*) 51 | echo "$1" 52 | echo "$1" >> "$RESOURCES_TO_COPY" 53 | ;; 54 | *) 55 | echo "${PODS_ROOT}/$1" 56 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 57 | ;; 58 | esac 59 | } 60 | 61 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 62 | if [[ "${ACTION}" == "install" ]]; then 63 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 64 | fi 65 | rm -f "$RESOURCES_TO_COPY" 66 | 67 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] 68 | then 69 | case "${TARGETED_DEVICE_FAMILY}" in 70 | 1,2) 71 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 72 | ;; 73 | 1) 74 | TARGET_DEVICE_ARGS="--target-device iphone" 75 | ;; 76 | 2) 77 | TARGET_DEVICE_ARGS="--target-device ipad" 78 | ;; 79 | *) 80 | TARGET_DEVICE_ARGS="--target-device mac" 81 | ;; 82 | esac 83 | 84 | # Find all other xcassets (this unfortunately includes those of path pods and other targets). 85 | OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) 86 | while read line; do 87 | if [[ $line != "`realpath $PODS_ROOT`*" ]]; then 88 | XCASSET_FILES+=("$line") 89 | fi 90 | done <<<"$OTHER_XCASSETS" 91 | 92 | printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 93 | fi 94 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/MBProgressHUD/README.mdown: -------------------------------------------------------------------------------- 1 | # MBProgressHUD [![Build Status](https://travis-ci.org/matej/MBProgressHUD.svg?branch=master)](https://travis-ci.org/matej/MBProgressHUD) 2 | 3 | MBProgressHUD is an iOS drop-in class that displays a translucent HUD with an indicator and/or labels while work is being done in a background thread. The HUD is meant as a replacement for the undocumented, private UIKit UIProgressHUD with some additional features. 4 | 5 | [![](http://dl.dropbox.com/u/378729/MBProgressHUD/1-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/1.png) 6 | [![](http://dl.dropbox.com/u/378729/MBProgressHUD/2-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/2.png) 7 | [![](http://dl.dropbox.com/u/378729/MBProgressHUD/3-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/3.png) 8 | [![](http://dl.dropbox.com/u/378729/MBProgressHUD/4-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/4.png) 9 | [![](http://dl.dropbox.com/u/378729/MBProgressHUD/5-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/5.png) 10 | [![](http://dl.dropbox.com/u/378729/MBProgressHUD/6-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/6.png) 11 | [![](http://dl.dropbox.com/u/378729/MBProgressHUD/7-thumb.png)](http://dl.dropbox.com/u/378729/MBProgressHUD/7.png) 12 | 13 | ## Requirements 14 | 15 | MBProgressHUD works on any iOS version and is compatible with both ARC and non-ARC projects. It depends on the following Apple frameworks, which should already be included with most Xcode templates: 16 | 17 | * Foundation.framework 18 | * UIKit.framework 19 | * CoreGraphics.framework 20 | 21 | You will need the latest developer tools in order to build MBProgressHUD. Old Xcode versions might work, but compatibility will not be explicitly maintained. 22 | 23 | ## Adding MBProgressHUD to your project 24 | 25 | ### Cocoapods 26 | 27 | [CocoaPods](http://cocoapods.org) is the recommended way to add MBProgressHUD to your project. 28 | 29 | 1. Add a pod entry for MBProgressHUD to your Podfile `pod 'MBProgressHUD', '~> 0.9.1'` 30 | 2. Install the pod(s) by running `pod install`. 31 | 3. Include MBProgressHUD wherever you need it with `#import "MBProgressHUD.h"`. 32 | 33 | ### Source files 34 | 35 | Alternatively you can directly add the `MBProgressHUD.h` and `MBProgressHUD.m` source files to your project. 36 | 37 | 1. Download the [latest code version](https://github.com/matej/MBProgressHUD/archive/master.zip) or add the repository as a git submodule to your git-tracked project. 38 | 2. Open your project in Xcode, then drag and drop `MBProgressHUD.h` and `MBProgressHUD.m` onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project. 39 | 3. Include MBProgressHUD wherever you need it with `#import "MBProgressHUD.h"`. 40 | 41 | ### Static library 42 | 43 | You can also add MBProgressHUD as a static library to your project or workspace. 44 | 45 | 1. Download the [latest code version](https://github.com/matej/MBProgressHUD/downloads) or add the repository as a git submodule to your git-tracked project. 46 | 2. Open your project in Xcode, then drag and drop `MBProgressHUD.xcodeproj` onto your project or workspace (use the "Product Navigator view"). 47 | 3. Select your target and go to the Build phases tab. In the Link Binary With Libraries section select the add button. On the sheet find and add `libMBProgressHUD.a`. You might also need to add `MBProgressHUD` to the Target Dependencies list. 48 | 4. Include MBProgressHUD wherever you need it with `#import `. 49 | 50 | ## Usage 51 | 52 | The main guideline you need to follow when dealing with MBProgressHUD while running long-running tasks is keeping the main thread work-free, so the UI can be updated promptly. The recommended way of using MBProgressHUD is therefore to set it up on the main thread and then spinning the task, that you want to perform, off onto a new thread. 53 | 54 | ```objective-c 55 | [MBProgressHUD showHUDAddedTo:self.view animated:YES]; 56 | dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ 57 | // Do something... 58 | dispatch_async(dispatch_get_main_queue(), ^{ 59 | [MBProgressHUD hideHUDForView:self.view animated:YES]; 60 | }); 61 | }); 62 | ``` 63 | 64 | If you need to configure the HUD you can do this by using the MBProgressHUD reference that showHUDAddedTo:animated: returns. 65 | 66 | ```objective-c 67 | MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; 68 | hud.mode = MBProgressHUDModeAnnularDeterminate; 69 | hud.labelText = @"Loading"; 70 | [self doSomethingInBackgroundWithProgressCallback:^(float progress) { 71 | hud.progress = progress; 72 | } completionCallback:^{ 73 | [hud hide:YES]; 74 | }]; 75 | ``` 76 | 77 | UI updates should always be done on the main thread. Some MBProgressHUD setters are however considered "thread safe" and can be called from background threads. Those also include `setMode:`, `setCustomView:`, `setLabelText:`, `setLabelFont:`, `setDetailsLabelText:`, `setDetailsLabelFont:` and `setProgress:`. 78 | 79 | If you need to run your long-running task in the main thread, you should perform it with a slight delay, so UIKit will have enough time to update the UI (i.e., draw the HUD) before you block the main thread with your task. 80 | 81 | ```objective-c 82 | [MBProgressHUD showHUDAddedTo:self.view animated:YES]; 83 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0.01 * NSEC_PER_SEC); 84 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ 85 | // Do something... 86 | [MBProgressHUD hideHUDForView:self.view animated:YES]; 87 | }); 88 | ``` 89 | 90 | You should be aware that any HUD updates issued inside the above block won't be displayed until the block completes. 91 | 92 | For more examples, including how to use MBProgressHUD with asynchronous operations such as NSURLConnection, take a look at the bundled demo project. Extensive API documentation is provided in the header file (MBProgressHUD.h). 93 | 94 | 95 | ## License 96 | 97 | This code is distributed under the terms and conditions of the [MIT license](LICENSE). 98 | 99 | ## Change-log 100 | 101 | A brief summary of each MBProgressHUD release can be found on the [wiki](https://github.com/matej/MBProgressHUD/wiki/Change-log). 102 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // BeginCLLocationOC 4 | // 5 | // Created by wamaker on 15/8/5. 6 | // Copyright (c) 2015年 wamaker. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | #import "MBProgressHUD.h" 12 | 13 | #import 14 | #import 15 | 16 | #define WS(weakSelf) __weak __typeof(&*self)weakSelf = self 17 | 18 | static NSTimeInterval const kTimeDelay = 2.5; 19 | 20 | @interface ViewController () 21 | 22 | @property (weak, nonatomic) IBOutlet MKMapView *mapView; 23 | @property (weak, nonatomic) IBOutlet UILabel *resultLabel; 24 | @property (weak, nonatomic) IBOutlet UITextField *addressField; 25 | @property (weak, nonatomic) IBOutlet UITextField *latitudeField; 26 | @property (weak, nonatomic) IBOutlet UITextField *longitudeField; 27 | 28 | @property (strong, nonatomic) MBProgressHUD *hud; 29 | @property (strong, nonatomic) CLLocationManager *locMgr; 30 | @property (strong, nonatomic) CLGeocoder *geocoder; 31 | 32 | - (IBAction)startLocating; 33 | - (IBAction)geocode; 34 | - (IBAction)reverseGeocode; 35 | 36 | @end 37 | 38 | @implementation ViewController 39 | 40 | - (CLLocationManager *)locMgr { 41 | if (!_locMgr) { 42 | _locMgr = [[CLLocationManager alloc] init]; 43 | _locMgr.delegate = self; 44 | 45 | // 定位精度 46 | _locMgr.desiredAccuracy = kCLLocationAccuracyBestForNavigation; 47 | // 距离过滤器,当移动距离小于这个值时不会收到回调 48 | // _locMgr.distanceFilter = 50; 49 | } 50 | return _locMgr; 51 | } 52 | 53 | - (CLGeocoder *)geocoder { 54 | if (!_geocoder) { 55 | _geocoder = [[CLGeocoder alloc] init]; 56 | } 57 | return _geocoder; 58 | } 59 | 60 | - (MKMapView *)mapView { 61 | if (!_mapView) { 62 | MKMapView *mapView = [[MKMapView alloc] init]; 63 | _mapView = mapView; 64 | 65 | _mapView.delegate = self; 66 | } 67 | 68 | return _mapView; 69 | } 70 | 71 | #pragma mark - Lifecycle 72 | 73 | - (void)viewDidLoad { 74 | [super viewDidLoad]; 75 | 76 | // 添加背景点击事件 77 | UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(backgroundTapped)]; 78 | recognizer.cancelsTouchesInView = NO; 79 | [self.view addGestureRecognizer:recognizer]; 80 | } 81 | 82 | - (void)didReceiveMemoryWarning { 83 | [super didReceiveMemoryWarning]; 84 | } 85 | 86 | #pragma mark - IBAction 87 | 88 | - (IBAction)startLocating { 89 | [self keyboardResign]; 90 | [self locationAuthorizationJudge]; 91 | } 92 | 93 | /** 94 | * 地理编码 95 | */ 96 | - (IBAction)geocode { 97 | [self keyboardResign]; 98 | 99 | if (self.addressField.text.length == 0) { 100 | [self showCommonTip:@"请填写地址"]; 101 | return; 102 | } 103 | 104 | [self showProcessHud:@"正在获取位置信息"]; 105 | 106 | WS(weakSelf); 107 | [self.geocoder geocodeAddressString:self.addressField.text completionHandler:^(NSArray *placemarks, NSError *error) { 108 | [weakSelf.hud hide:YES]; 109 | 110 | if (error) { 111 | [weakSelf showCommonTip:@"地理编码出错,或许你选的地方在冥王星"]; 112 | NSLog(@"%@", error); 113 | return; 114 | } 115 | 116 | CLPlacemark *placemark = [placemarks firstObject]; 117 | NSString *formatString = [NSString stringWithFormat:@"经度:%lf,纬度:%lf\n%@ %@ %@\n%@\n%@ %@", placemark.location.coordinate.latitude, placemark.location.coordinate.longitude, placemark.addressDictionary[@"City"], placemark.addressDictionary[@"Country"], placemark.addressDictionary[@"CountryCode"], [placemark.addressDictionary[@"FormattedAddressLines"] firstObject], placemark.addressDictionary[@"Name"], placemark.addressDictionary[@"State"]]; 118 | weakSelf.resultLabel.text = formatString; 119 | [weakSelf showInMapWithCoordinate:CLLocationCoordinate2DMake(placemark.location.coordinate.latitude, placemark.location.coordinate.longitude)]; 120 | 121 | for (CLPlacemark *pm in placemarks) { 122 | NSLog(@"经度:%lf,纬度:%lf\n%@ %@ %@\n%@\n%@ %@", pm.location.coordinate.latitude, pm.location.coordinate.longitude, pm.addressDictionary[@"City"], pm.addressDictionary[@"Country"], pm.addressDictionary[@"CountryCode"], [pm.addressDictionary[@"FormattedAddressLines"] firstObject], pm.addressDictionary[@"Name"], pm.addressDictionary[@"State"]); 123 | } 124 | }]; 125 | } 126 | 127 | /** 128 | * 反地理编码 129 | */ 130 | - (IBAction)reverseGeocode { 131 | [self keyboardResign]; 132 | 133 | if (self.latitudeField.text.length == 0 || self.longitudeField.text.length == 0) { 134 | [self showCommonTip:@"请填写经纬度"]; 135 | return; 136 | } 137 | 138 | [self showProcessHud:@"正在获取位置信息"]; 139 | 140 | CLLocationDegrees latitude = [self.latitudeField.text doubleValue]; 141 | CLLocationDegrees longitude = [self.longitudeField.text doubleValue]; 142 | CLLocation *location = [[CLLocation alloc] initWithLatitude:latitude longitude:longitude]; 143 | 144 | WS(weakSelf); 145 | [self.geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) { 146 | [weakSelf.hud hide:YES]; 147 | 148 | if (error) { 149 | [weakSelf showCommonTip:@"地理编码出错,或许你选的地方在冥王星"]; 150 | NSLog(@"%@", error); 151 | return; 152 | } 153 | 154 | CLPlacemark *placemark = [placemarks firstObject]; 155 | NSString *formatString = [NSString stringWithFormat:@"经度:%lf,纬度:%lf\n%@ %@ %@\n%@\n%@ %@", placemark.location.coordinate.latitude, placemark.location.coordinate.longitude, placemark.addressDictionary[@"City"], placemark.addressDictionary[@"Country"], placemark.addressDictionary[@"CountryCode"], [placemark.addressDictionary[@"FormattedAddressLines"] firstObject], placemark.addressDictionary[@"Name"], placemark.addressDictionary[@"State"]]; 156 | weakSelf.resultLabel.text = formatString; 157 | [weakSelf showInMapWithCoordinate:CLLocationCoordinate2DMake(latitude, longitude)]; 158 | 159 | for (CLPlacemark *pm in placemarks) { 160 | NSLog(@"经度:%lf,纬度:%lf\n%@ %@ %@\n%@\n%@ %@", pm.location.coordinate.latitude, pm.location.coordinate.longitude, pm.addressDictionary[@"City"], pm.addressDictionary[@"Country"], pm.addressDictionary[@"CountryCode"], [pm.addressDictionary[@"FormattedAddressLines"] firstObject], pm.addressDictionary[@"Name"], pm.addressDictionary[@"State"]); 161 | } 162 | }]; 163 | } 164 | 165 | #pragma mark - Private 166 | 167 | - (void)showCommonTip:(NSString *)tip { 168 | self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; 169 | self.hud.mode = MBProgressHUDModeText; 170 | self.hud.labelText = tip; 171 | self.hud.removeFromSuperViewOnHide = YES; 172 | [self.hud hide:YES afterDelay:kTimeDelay]; 173 | } 174 | 175 | - (void)showProcessHud:(NSString *)msg { 176 | self.hud = [[MBProgressHUD alloc] initWithView:self.view]; 177 | [self.view addSubview:self.hud]; 178 | self.hud.removeFromSuperViewOnHide = YES; 179 | self.hud.mode = MBProgressHUDModeIndeterminate; 180 | self.hud.labelText = msg; 181 | [self.hud show:NO]; 182 | } 183 | 184 | /** 185 | * 点击空白处收起键盘 186 | */ 187 | - (void)backgroundTapped { 188 | [self keyboardResign]; 189 | } 190 | 191 | - (void)keyboardResign { 192 | [self.view endEditing:YES]; 193 | } 194 | 195 | /** 196 | * 判断定位授权 197 | */ 198 | - (void)locationAuthorizationJudge { 199 | CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; 200 | 201 | NSString *locationServicesEnabled = [CLLocationManager locationServicesEnabled] ? @"YES" : @"NO"; 202 | NSLog(@"location services enabled = %@", locationServicesEnabled); 203 | 204 | if (status == kCLAuthorizationStatusNotDetermined) { // 如果授权状态还没有被决定就弹出提示框 205 | if ([self.locMgr respondsToSelector:@selector(requestWhenInUseAuthorization)]) { 206 | [self.locMgr requestWhenInUseAuthorization]; 207 | // [self.locMgr requestAlwaysAuthorization]; 208 | } 209 | 210 | // 也可以判断当前系统版本是否大于8.0 211 | // if ([[UIDevice currentDevice].systemVersion doubleValue] >= 8.0) { 212 | // [self.locMgr requestWhenInUseAuthorization]; 213 | // } 214 | } else if (status == kCLAuthorizationStatusDenied) { // 如果授权状态是拒绝就给用户提示 215 | [self showCommonTip:@"请前往设置-隐私-定位中打开定位服务"]; 216 | } else if (status == kCLAuthorizationStatusAuthorizedWhenInUse || status == kCLAuthorizationStatusAuthorizedAlways) { // 如果授权状态可以使用就开始获取用户位置 217 | [self.locMgr startUpdatingLocation]; 218 | } 219 | } 220 | 221 | /** 222 | * 计算两个坐标之间的直线距离; 223 | */ 224 | - (void)calculateStraightDistance { 225 | CLLocation *loc1 = [[CLLocation alloc] initWithLatitude:30 longitude:123]; 226 | CLLocation *loc2 = [[CLLocation alloc] initWithLatitude:31 longitude:124]; 227 | CLLocationDistance distances = [loc1 distanceFromLocation:loc2]; 228 | NSLog(@"两点之间的直线距离是%lf", distances); 229 | } 230 | 231 | /** 232 | * 将位置信息显示到mapView上 233 | */ 234 | - (void)showInMapWithCoordinate:(CLLocationCoordinate2D)coordinate { 235 | MKCoordinateRegion region = MKCoordinateRegionMake(coordinate, MKCoordinateSpanMake(0.025, 0.025)); 236 | [self.mapView setRegion:region animated:YES]; 237 | 238 | [self addAnnotation:coordinate]; 239 | } 240 | 241 | /** 242 | * 添加大头针 243 | */ 244 | - (void)addAnnotation:(CLLocationCoordinate2D)coordinate { 245 | [self.mapView removeAnnotations:self.mapView.annotations]; 246 | 247 | MKPointAnnotation *annotation = [[MKPointAnnotation alloc] init]; 248 | annotation.title = @"here"; 249 | annotation.coordinate = coordinate; 250 | [self.mapView addAnnotation:annotation]; 251 | } 252 | 253 | #pragma mark - CLLocationManagerDelegate 254 | 255 | /** 256 | * 只要定位到位置,就会调用,调用频率频繁 257 | */ 258 | - (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations { 259 | CLLocation *location = [locations lastObject]; 260 | NSLog(@"我的位置是 - %@", location); 261 | [self showInMapWithCoordinate:location.coordinate]; 262 | // 根据不同需要停止更新位置 263 | [self.locMgr stopUpdatingLocation]; 264 | } 265 | 266 | @end 267 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC/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 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 80 | 81 | 82 | 83 | 84 | 85 | 95 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/MBProgressHUD/MBProgressHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // MBProgressHUD.h 3 | // Version 0.9.1 4 | // Created by Matej Bukovinski on 2.4.09. 5 | // 6 | 7 | // This code is distributed under the terms and conditions of the MIT license. 8 | 9 | // Copyright (c) 2009-2015 Matej Bukovinski 10 | // 11 | // Permission is hereby granted, free of charge, to any person obtaining a copy 12 | // of this software and associated documentation files (the "Software"), to deal 13 | // in the Software without restriction, including without limitation the rights 14 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | // copies of the Software, and to permit persons to whom the Software is 16 | // furnished to do so, subject to the following conditions: 17 | // 18 | // The above copyright notice and this permission notice shall be included in 19 | // all copies or substantial portions of the Software. 20 | // 21 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | // THE SOFTWARE. 28 | 29 | #import 30 | #import 31 | #import 32 | 33 | @protocol MBProgressHUDDelegate; 34 | 35 | 36 | typedef NS_ENUM(NSInteger, MBProgressHUDMode) { 37 | /** Progress is shown using an UIActivityIndicatorView. This is the default. */ 38 | MBProgressHUDModeIndeterminate, 39 | /** Progress is shown using a round, pie-chart like, progress view. */ 40 | MBProgressHUDModeDeterminate, 41 | /** Progress is shown using a horizontal progress bar */ 42 | MBProgressHUDModeDeterminateHorizontalBar, 43 | /** Progress is shown using a ring-shaped progress view. */ 44 | MBProgressHUDModeAnnularDeterminate, 45 | /** Shows a custom view */ 46 | MBProgressHUDModeCustomView, 47 | /** Shows only labels */ 48 | MBProgressHUDModeText 49 | }; 50 | 51 | typedef NS_ENUM(NSInteger, MBProgressHUDAnimation) { 52 | /** Opacity animation */ 53 | MBProgressHUDAnimationFade, 54 | /** Opacity + scale animation */ 55 | MBProgressHUDAnimationZoom, 56 | MBProgressHUDAnimationZoomOut = MBProgressHUDAnimationZoom, 57 | MBProgressHUDAnimationZoomIn 58 | }; 59 | 60 | 61 | #ifndef MB_INSTANCETYPE 62 | #if __has_feature(objc_instancetype) 63 | #define MB_INSTANCETYPE instancetype 64 | #else 65 | #define MB_INSTANCETYPE id 66 | #endif 67 | #endif 68 | 69 | #ifndef MB_STRONG 70 | #if __has_feature(objc_arc) 71 | #define MB_STRONG strong 72 | #else 73 | #define MB_STRONG retain 74 | #endif 75 | #endif 76 | 77 | #ifndef MB_WEAK 78 | #if __has_feature(objc_arc_weak) 79 | #define MB_WEAK weak 80 | #elif __has_feature(objc_arc) 81 | #define MB_WEAK unsafe_unretained 82 | #else 83 | #define MB_WEAK assign 84 | #endif 85 | #endif 86 | 87 | #if NS_BLOCKS_AVAILABLE 88 | typedef void (^MBProgressHUDCompletionBlock)(); 89 | #endif 90 | 91 | 92 | /** 93 | * Displays a simple HUD window containing a progress indicator and two optional labels for short messages. 94 | * 95 | * This is a simple drop-in class for displaying a progress HUD view similar to Apple's private UIProgressHUD class. 96 | * The MBProgressHUD window spans over the entire space given to it by the initWithFrame constructor and catches all 97 | * user input on this region, thereby preventing the user operations on components below the view. The HUD itself is 98 | * drawn centered as a rounded semi-transparent view which resizes depending on the user specified content. 99 | * 100 | * This view supports four modes of operation: 101 | * - MBProgressHUDModeIndeterminate - shows a UIActivityIndicatorView 102 | * - MBProgressHUDModeDeterminate - shows a custom round progress indicator 103 | * - MBProgressHUDModeAnnularDeterminate - shows a custom annular progress indicator 104 | * - MBProgressHUDModeCustomView - shows an arbitrary, user specified view (@see customView) 105 | * 106 | * All three modes can have optional labels assigned: 107 | * - If the labelText property is set and non-empty then a label containing the provided content is placed below the 108 | * indicator view. 109 | * - If also the detailsLabelText property is set then another label is placed below the first label. 110 | */ 111 | @interface MBProgressHUD : UIView 112 | 113 | /** 114 | * Creates a new HUD, adds it to provided view and shows it. The counterpart to this method is hideHUDForView:animated:. 115 | * 116 | * @param view The view that the HUD will be added to 117 | * @param animated If set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use 118 | * animations while appearing. 119 | * @return A reference to the created HUD. 120 | * 121 | * @see hideHUDForView:animated: 122 | * @see animationType 123 | */ 124 | + (MB_INSTANCETYPE)showHUDAddedTo:(UIView *)view animated:(BOOL)animated; 125 | 126 | /** 127 | * Finds the top-most HUD subview and hides it. The counterpart to this method is showHUDAddedTo:animated:. 128 | * 129 | * @param view The view that is going to be searched for a HUD subview. 130 | * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use 131 | * animations while disappearing. 132 | * @return YES if a HUD was found and removed, NO otherwise. 133 | * 134 | * @see showHUDAddedTo:animated: 135 | * @see animationType 136 | */ 137 | + (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated; 138 | 139 | /** 140 | * Finds all the HUD subviews and hides them. 141 | * 142 | * @param view The view that is going to be searched for HUD subviews. 143 | * @param animated If set to YES the HUDs will disappear using the current animationType. If set to NO the HUDs will not use 144 | * animations while disappearing. 145 | * @return the number of HUDs found and removed. 146 | * 147 | * @see hideHUDForView:animated: 148 | * @see animationType 149 | */ 150 | + (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated; 151 | 152 | /** 153 | * Finds the top-most HUD subview and returns it. 154 | * 155 | * @param view The view that is going to be searched. 156 | * @return A reference to the last HUD subview discovered. 157 | */ 158 | + (MB_INSTANCETYPE)HUDForView:(UIView *)view; 159 | 160 | /** 161 | * Finds all HUD subviews and returns them. 162 | * 163 | * @param view The view that is going to be searched. 164 | * @return All found HUD views (array of MBProgressHUD objects). 165 | */ 166 | + (NSArray *)allHUDsForView:(UIView *)view; 167 | 168 | /** 169 | * A convenience constructor that initializes the HUD with the window's bounds. Calls the designated constructor with 170 | * window.bounds as the parameter. 171 | * 172 | * @param window The window instance that will provide the bounds for the HUD. Should be the same instance as 173 | * the HUD's superview (i.e., the window that the HUD will be added to). 174 | */ 175 | - (id)initWithWindow:(UIWindow *)window; 176 | 177 | /** 178 | * A convenience constructor that initializes the HUD with the view's bounds. Calls the designated constructor with 179 | * view.bounds as the parameter 180 | * 181 | * @param view The view instance that will provide the bounds for the HUD. Should be the same instance as 182 | * the HUD's superview (i.e., the view that the HUD will be added to). 183 | */ 184 | - (id)initWithView:(UIView *)view; 185 | 186 | /** 187 | * Display the HUD. You need to make sure that the main thread completes its run loop soon after this method call so 188 | * the user interface can be updated. Call this method when your task is already set-up to be executed in a new thread 189 | * (e.g., when using something like NSOperation or calling an asynchronous call like NSURLRequest). 190 | * 191 | * @param animated If set to YES the HUD will appear using the current animationType. If set to NO the HUD will not use 192 | * animations while appearing. 193 | * 194 | * @see animationType 195 | */ 196 | - (void)show:(BOOL)animated; 197 | 198 | /** 199 | * Hide the HUD. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to 200 | * hide the HUD when your task completes. 201 | * 202 | * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use 203 | * animations while disappearing. 204 | * 205 | * @see animationType 206 | */ 207 | - (void)hide:(BOOL)animated; 208 | 209 | /** 210 | * Hide the HUD after a delay. This still calls the hudWasHidden: delegate. This is the counterpart of the show: method. Use it to 211 | * hide the HUD when your task completes. 212 | * 213 | * @param animated If set to YES the HUD will disappear using the current animationType. If set to NO the HUD will not use 214 | * animations while disappearing. 215 | * @param delay Delay in seconds until the HUD is hidden. 216 | * 217 | * @see animationType 218 | */ 219 | - (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay; 220 | 221 | /** 222 | * Shows the HUD while a background task is executing in a new thread, then hides the HUD. 223 | * 224 | * This method also takes care of autorelease pools so your method does not have to be concerned with setting up a 225 | * pool. 226 | * 227 | * @param method The method to be executed while the HUD is shown. This method will be executed in a new thread. 228 | * @param target The object that the target method belongs to. 229 | * @param object An optional object to be passed to the method. 230 | * @param animated If set to YES the HUD will (dis)appear using the current animationType. If set to NO the HUD will not use 231 | * animations while (dis)appearing. 232 | */ 233 | - (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated; 234 | 235 | #if NS_BLOCKS_AVAILABLE 236 | 237 | /** 238 | * Shows the HUD while a block is executing on a background queue, then hides the HUD. 239 | * 240 | * @see showAnimated:whileExecutingBlock:onQueue:completionBlock: 241 | */ 242 | - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block; 243 | 244 | /** 245 | * Shows the HUD while a block is executing on a background queue, then hides the HUD. 246 | * 247 | * @see showAnimated:whileExecutingBlock:onQueue:completionBlock: 248 | */ 249 | - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(MBProgressHUDCompletionBlock)completion; 250 | 251 | /** 252 | * Shows the HUD while a block is executing on the specified dispatch queue, then hides the HUD. 253 | * 254 | * @see showAnimated:whileExecutingBlock:onQueue:completionBlock: 255 | */ 256 | - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue; 257 | 258 | /** 259 | * Shows the HUD while a block is executing on the specified dispatch queue, executes completion block on the main queue, and then hides the HUD. 260 | * 261 | * @param animated If set to YES the HUD will (dis)appear using the current animationType. If set to NO the HUD will 262 | * not use animations while (dis)appearing. 263 | * @param block The block to be executed while the HUD is shown. 264 | * @param queue The dispatch queue on which the block should be executed. 265 | * @param completion The block to be executed on completion. 266 | * 267 | * @see completionBlock 268 | */ 269 | - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue 270 | completionBlock:(MBProgressHUDCompletionBlock)completion; 271 | 272 | /** 273 | * A block that gets called after the HUD was completely hidden. 274 | */ 275 | @property (copy) MBProgressHUDCompletionBlock completionBlock; 276 | 277 | #endif 278 | 279 | /** 280 | * MBProgressHUD operation mode. The default is MBProgressHUDModeIndeterminate. 281 | * 282 | * @see MBProgressHUDMode 283 | */ 284 | @property (assign) MBProgressHUDMode mode; 285 | 286 | /** 287 | * The animation type that should be used when the HUD is shown and hidden. 288 | * 289 | * @see MBProgressHUDAnimation 290 | */ 291 | @property (assign) MBProgressHUDAnimation animationType; 292 | 293 | /** 294 | * The UIView (e.g., a UIImageView) to be shown when the HUD is in MBProgressHUDModeCustomView. 295 | * For best results use a 37 by 37 pixel view (so the bounds match the built in indicator bounds). 296 | */ 297 | @property (MB_STRONG) UIView *customView; 298 | 299 | /** 300 | * The HUD delegate object. 301 | * 302 | * @see MBProgressHUDDelegate 303 | */ 304 | @property (MB_WEAK) id delegate; 305 | 306 | /** 307 | * An optional short message to be displayed below the activity indicator. The HUD is automatically resized to fit 308 | * the entire text. If the text is too long it will get clipped by displaying "..." at the end. If left unchanged or 309 | * set to @"", then no message is displayed. 310 | */ 311 | @property (copy) NSString *labelText; 312 | 313 | /** 314 | * An optional details message displayed below the labelText message. This message is displayed only if the labelText 315 | * property is also set and is different from an empty string (@""). The details text can span multiple lines. 316 | */ 317 | @property (copy) NSString *detailsLabelText; 318 | 319 | /** 320 | * The opacity of the HUD window. Defaults to 0.8 (80% opacity). 321 | */ 322 | @property (assign) float opacity; 323 | 324 | /** 325 | * The color of the HUD window. Defaults to black. If this property is set, color is set using 326 | * this UIColor and the opacity property is not used. using retain because performing copy on 327 | * UIColor base colors (like [UIColor greenColor]) cause problems with the copyZone. 328 | */ 329 | @property (MB_STRONG) UIColor *color; 330 | 331 | /** 332 | * The x-axis offset of the HUD relative to the centre of the superview. 333 | */ 334 | @property (assign) float xOffset; 335 | 336 | /** 337 | * The y-axis offset of the HUD relative to the centre of the superview. 338 | */ 339 | @property (assign) float yOffset; 340 | 341 | /** 342 | * The amount of space between the HUD edge and the HUD elements (labels, indicators or custom views). 343 | * Defaults to 20.0 344 | */ 345 | @property (assign) float margin; 346 | 347 | /** 348 | * The corner radius for the HUD 349 | * Defaults to 10.0 350 | */ 351 | @property (assign) float cornerRadius; 352 | 353 | /** 354 | * Cover the HUD background view with a radial gradient. 355 | */ 356 | @property (assign) BOOL dimBackground; 357 | 358 | /* 359 | * Grace period is the time (in seconds) that the invoked method may be run without 360 | * showing the HUD. If the task finishes before the grace time runs out, the HUD will 361 | * not be shown at all. 362 | * This may be used to prevent HUD display for very short tasks. 363 | * Defaults to 0 (no grace time). 364 | * Grace time functionality is only supported when the task status is known! 365 | * @see taskInProgress 366 | */ 367 | @property (assign) float graceTime; 368 | 369 | /** 370 | * The minimum time (in seconds) that the HUD is shown. 371 | * This avoids the problem of the HUD being shown and than instantly hidden. 372 | * Defaults to 0 (no minimum show time). 373 | */ 374 | @property (assign) float minShowTime; 375 | 376 | /** 377 | * Indicates that the executed operation is in progress. Needed for correct graceTime operation. 378 | * If you don't set a graceTime (different than 0.0) this does nothing. 379 | * This property is automatically set when using showWhileExecuting:onTarget:withObject:animated:. 380 | * When threading is done outside of the HUD (i.e., when the show: and hide: methods are used directly), 381 | * you need to set this property when your task starts and completes in order to have normal graceTime 382 | * functionality. 383 | */ 384 | @property (assign) BOOL taskInProgress; 385 | 386 | /** 387 | * Removes the HUD from its parent view when hidden. 388 | * Defaults to NO. 389 | */ 390 | @property (assign) BOOL removeFromSuperViewOnHide; 391 | 392 | /** 393 | * Font to be used for the main label. Set this property if the default is not adequate. 394 | */ 395 | @property (MB_STRONG) UIFont* labelFont; 396 | 397 | /** 398 | * Color to be used for the main label. Set this property if the default is not adequate. 399 | */ 400 | @property (MB_STRONG) UIColor* labelColor; 401 | 402 | /** 403 | * Font to be used for the details label. Set this property if the default is not adequate. 404 | */ 405 | @property (MB_STRONG) UIFont* detailsLabelFont; 406 | 407 | /** 408 | * Color to be used for the details label. Set this property if the default is not adequate. 409 | */ 410 | @property (MB_STRONG) UIColor* detailsLabelColor; 411 | 412 | /** 413 | * The color of the activity indicator. Defaults to [UIColor whiteColor] 414 | * Does nothing on pre iOS 5. 415 | */ 416 | @property (MB_STRONG) UIColor *activityIndicatorColor; 417 | 418 | /** 419 | * The progress of the progress indicator, from 0.0 to 1.0. Defaults to 0.0. 420 | */ 421 | @property (assign) float progress; 422 | 423 | /** 424 | * The minimum size of the HUD bezel. Defaults to CGSizeZero (no minimum size). 425 | */ 426 | @property (assign) CGSize minSize; 427 | 428 | 429 | /** 430 | * The actual size of the HUD bezel. 431 | * You can use this to limit touch handling on the bezel aria only. 432 | * @see https://github.com/jdg/MBProgressHUD/pull/200 433 | */ 434 | @property (atomic, assign, readonly) CGSize size; 435 | 436 | 437 | /** 438 | * Force the HUD dimensions to be equal if possible. 439 | */ 440 | @property (assign, getter = isSquare) BOOL square; 441 | 442 | @end 443 | 444 | 445 | @protocol MBProgressHUDDelegate 446 | 447 | @optional 448 | 449 | /** 450 | * Called after the HUD was fully hidden from the screen. 451 | */ 452 | - (void)hudWasHidden:(MBProgressHUD *)hud; 453 | 454 | @end 455 | 456 | 457 | /** 458 | * A progress view for showing definite progress by filling up a circle (pie chart). 459 | */ 460 | @interface MBRoundProgressView : UIView 461 | 462 | /** 463 | * Progress (0.0 to 1.0) 464 | */ 465 | @property (nonatomic, assign) float progress; 466 | 467 | /** 468 | * Indicator progress color. 469 | * Defaults to white [UIColor whiteColor] 470 | */ 471 | @property (nonatomic, MB_STRONG) UIColor *progressTintColor; 472 | 473 | /** 474 | * Indicator background (non-progress) color. 475 | * Defaults to translucent white (alpha 0.1) 476 | */ 477 | @property (nonatomic, MB_STRONG) UIColor *backgroundTintColor; 478 | 479 | /* 480 | * Display mode - NO = round or YES = annular. Defaults to round. 481 | */ 482 | @property (nonatomic, assign, getter = isAnnular) BOOL annular; 483 | 484 | @end 485 | 486 | 487 | /** 488 | * A flat bar progress view. 489 | */ 490 | @interface MBBarProgressView : UIView 491 | 492 | /** 493 | * Progress (0.0 to 1.0) 494 | */ 495 | @property (nonatomic, assign) float progress; 496 | 497 | /** 498 | * Bar border line color. 499 | * Defaults to white [UIColor whiteColor]. 500 | */ 501 | @property (nonatomic, MB_STRONG) UIColor *lineColor; 502 | 503 | /** 504 | * Bar background color. 505 | * Defaults to clear [UIColor clearColor]; 506 | */ 507 | @property (nonatomic, MB_STRONG) UIColor *progressRemainingColor; 508 | 509 | /** 510 | * Bar progress color. 511 | * Defaults to white [UIColor whiteColor]. 512 | */ 513 | @property (nonatomic, MB_STRONG) UIColor *progressColor; 514 | 515 | @end 516 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/Pods.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0DFC545FAE6B5AEF36DE0C3C /* MBProgressHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = 87C9CAABB121B09A395F4BE8 /* MBProgressHUD.h */; }; 11 | 130971F308D55BDD0F42CB48 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7BC2E5F472DC89BCF15822E /* Foundation.framework */; }; 12 | 2CDD6ADCB6E2ED38F01FC3F1 /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = D878CFE5A9939CE2851C1973 /* MBProgressHUD.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; 13 | 82CDF1709D9610231D042285 /* Pods-MBProgressHUD-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = CACA50F00ACCA5F58E76C08A /* Pods-MBProgressHUD-dummy.m */; }; 14 | ABE7991860E66ECFC6A98572 /* Pods-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BA124509FEC098160D6730F /* Pods-dummy.m */; }; 15 | D2ABBC62DA404FC1D1364499 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7BC2E5F472DC89BCF15822E /* Foundation.framework */; }; 16 | E5E740F230775EAC3C32B4FB /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 051F8B5B34D3337D64156EE0 /* CoreGraphics.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | 8FD11BDC6A8416F7204EBA76 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = F6198E1D81B78EE00FA747AD /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = AAA02690B64E7B12CCCCB08A; 25 | remoteInfo = "Pods-MBProgressHUD"; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 051F8B5B34D3337D64156EE0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; 31 | 1EA35FAFA0052DC235B7C1FE /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; 32 | 27321E545AFE195C830DD5AB /* Pods-environment.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-environment.h"; sourceTree = ""; }; 33 | 41F3D1F9639CFAD0F0870D5A /* Pods-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-acknowledgements.markdown"; sourceTree = ""; }; 34 | 4A782F57EE53FF5847F26A24 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 35 | 4B022FCB980B16F9517EE57D /* Pods-MBProgressHUD.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-MBProgressHUD.xcconfig"; sourceTree = ""; }; 36 | 4FD4B4F556B29F6183692A2F /* Pods-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-resources.sh"; sourceTree = ""; }; 37 | 56A85CCABE84D51CF09ACA0C /* Pods-MBProgressHUD-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-MBProgressHUD-Private.xcconfig"; sourceTree = ""; }; 38 | 5BA124509FEC098160D6730F /* Pods-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-dummy.m"; sourceTree = ""; }; 39 | 87C9CAABB121B09A395F4BE8 /* MBProgressHUD.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = MBProgressHUD.h; sourceTree = ""; }; 40 | 8821CC17D30513BE43E4706E /* Pods-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-acknowledgements.plist"; sourceTree = ""; }; 41 | 9ECB6D8BC6D57DEC84E50AF8 /* libPods-MBProgressHUD.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MBProgressHUD.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 42 | A7BC2E5F472DC89BCF15822E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 43 | B8DC57464F228EF45A855255 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.release.xcconfig; sourceTree = ""; }; 44 | CACA50F00ACCA5F58E76C08A /* Pods-MBProgressHUD-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-MBProgressHUD-dummy.m"; sourceTree = ""; }; 45 | D242D1D9265F1FAB5D507740 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.debug.xcconfig; sourceTree = ""; }; 46 | D878CFE5A9939CE2851C1973 /* MBProgressHUD.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = MBProgressHUD.m; sourceTree = ""; }; 47 | EB5C3CC6D64B49893EAAAB69 /* Pods-MBProgressHUD-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-MBProgressHUD-prefix.pch"; sourceTree = ""; }; 48 | /* End PBXFileReference section */ 49 | 50 | /* Begin PBXFrameworksBuildPhase section */ 51 | 5664A2834379D56C6BF7DC3F /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | E5E740F230775EAC3C32B4FB /* CoreGraphics.framework in Frameworks */, 56 | 130971F308D55BDD0F42CB48 /* Foundation.framework in Frameworks */, 57 | ); 58 | runOnlyForDeploymentPostprocessing = 0; 59 | }; 60 | 852A568273C3C1440A98904C /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | D2ABBC62DA404FC1D1364499 /* Foundation.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 016716094D9E27B492EDF013 /* Targets Support Files */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 6425E0CDD36C171323D8E26E /* Pods */, 75 | ); 76 | name = "Targets Support Files"; 77 | sourceTree = ""; 78 | }; 79 | 1305B4D1F441B3F1E23AFD82 /* MBProgressHUD */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | 87C9CAABB121B09A395F4BE8 /* MBProgressHUD.h */, 83 | D878CFE5A9939CE2851C1973 /* MBProgressHUD.m */, 84 | DEBB43D59F6376DD806C392E /* Support Files */, 85 | ); 86 | path = MBProgressHUD; 87 | sourceTree = ""; 88 | }; 89 | 17EE5EC6E6722C334CCC0630 = { 90 | isa = PBXGroup; 91 | children = ( 92 | 1EA35FAFA0052DC235B7C1FE /* Podfile */, 93 | F57A1B21F2D94FD1060227EA /* Frameworks */, 94 | 87E3B5148CCA7D0577224815 /* Pods */, 95 | C378CDDBA905CC2A52F2E389 /* Products */, 96 | 016716094D9E27B492EDF013 /* Targets Support Files */, 97 | ); 98 | sourceTree = ""; 99 | }; 100 | 41B7631F2A45E7DEA7D1EFFD /* iOS */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 051F8B5B34D3337D64156EE0 /* CoreGraphics.framework */, 104 | A7BC2E5F472DC89BCF15822E /* Foundation.framework */, 105 | ); 106 | name = iOS; 107 | sourceTree = ""; 108 | }; 109 | 6425E0CDD36C171323D8E26E /* Pods */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 41F3D1F9639CFAD0F0870D5A /* Pods-acknowledgements.markdown */, 113 | 8821CC17D30513BE43E4706E /* Pods-acknowledgements.plist */, 114 | 5BA124509FEC098160D6730F /* Pods-dummy.m */, 115 | 27321E545AFE195C830DD5AB /* Pods-environment.h */, 116 | 4FD4B4F556B29F6183692A2F /* Pods-resources.sh */, 117 | D242D1D9265F1FAB5D507740 /* Pods.debug.xcconfig */, 118 | B8DC57464F228EF45A855255 /* Pods.release.xcconfig */, 119 | ); 120 | name = Pods; 121 | path = "Target Support Files/Pods"; 122 | sourceTree = ""; 123 | }; 124 | 87E3B5148CCA7D0577224815 /* Pods */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | 1305B4D1F441B3F1E23AFD82 /* MBProgressHUD */, 128 | ); 129 | name = Pods; 130 | sourceTree = ""; 131 | }; 132 | C378CDDBA905CC2A52F2E389 /* Products */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | 4A782F57EE53FF5847F26A24 /* libPods.a */, 136 | 9ECB6D8BC6D57DEC84E50AF8 /* libPods-MBProgressHUD.a */, 137 | ); 138 | name = Products; 139 | sourceTree = ""; 140 | }; 141 | DEBB43D59F6376DD806C392E /* Support Files */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | 4B022FCB980B16F9517EE57D /* Pods-MBProgressHUD.xcconfig */, 145 | 56A85CCABE84D51CF09ACA0C /* Pods-MBProgressHUD-Private.xcconfig */, 146 | CACA50F00ACCA5F58E76C08A /* Pods-MBProgressHUD-dummy.m */, 147 | EB5C3CC6D64B49893EAAAB69 /* Pods-MBProgressHUD-prefix.pch */, 148 | ); 149 | name = "Support Files"; 150 | path = "../Target Support Files/Pods-MBProgressHUD"; 151 | sourceTree = ""; 152 | }; 153 | F57A1B21F2D94FD1060227EA /* Frameworks */ = { 154 | isa = PBXGroup; 155 | children = ( 156 | 41B7631F2A45E7DEA7D1EFFD /* iOS */, 157 | ); 158 | name = Frameworks; 159 | sourceTree = ""; 160 | }; 161 | /* End PBXGroup section */ 162 | 163 | /* Begin PBXHeadersBuildPhase section */ 164 | 09673C41582BB32D6E9E3EB1 /* Headers */ = { 165 | isa = PBXHeadersBuildPhase; 166 | buildActionMask = 2147483647; 167 | files = ( 168 | 0DFC545FAE6B5AEF36DE0C3C /* MBProgressHUD.h in Headers */, 169 | ); 170 | runOnlyForDeploymentPostprocessing = 0; 171 | }; 172 | /* End PBXHeadersBuildPhase section */ 173 | 174 | /* Begin PBXNativeTarget section */ 175 | 09427C076A21DC0E002EF51F /* Pods */ = { 176 | isa = PBXNativeTarget; 177 | buildConfigurationList = 4F77E3AC1C5CDA9C31F79E65 /* Build configuration list for PBXNativeTarget "Pods" */; 178 | buildPhases = ( 179 | 419BE9083A546025040525EB /* Sources */, 180 | 852A568273C3C1440A98904C /* Frameworks */, 181 | ); 182 | buildRules = ( 183 | ); 184 | dependencies = ( 185 | 3337A6ACE1D24F7638E2FBB7 /* PBXTargetDependency */, 186 | ); 187 | name = Pods; 188 | productName = Pods; 189 | productReference = 4A782F57EE53FF5847F26A24 /* libPods.a */; 190 | productType = "com.apple.product-type.library.static"; 191 | }; 192 | AAA02690B64E7B12CCCCB08A /* Pods-MBProgressHUD */ = { 193 | isa = PBXNativeTarget; 194 | buildConfigurationList = 449ECEE9AF2063DFEED6BA28 /* Build configuration list for PBXNativeTarget "Pods-MBProgressHUD" */; 195 | buildPhases = ( 196 | DAE85042296876AA7A12FD8F /* Sources */, 197 | 5664A2834379D56C6BF7DC3F /* Frameworks */, 198 | 09673C41582BB32D6E9E3EB1 /* Headers */, 199 | ); 200 | buildRules = ( 201 | ); 202 | dependencies = ( 203 | ); 204 | name = "Pods-MBProgressHUD"; 205 | productName = "Pods-MBProgressHUD"; 206 | productReference = 9ECB6D8BC6D57DEC84E50AF8 /* libPods-MBProgressHUD.a */; 207 | productType = "com.apple.product-type.library.static"; 208 | }; 209 | /* End PBXNativeTarget section */ 210 | 211 | /* Begin PBXProject section */ 212 | F6198E1D81B78EE00FA747AD /* Project object */ = { 213 | isa = PBXProject; 214 | attributes = { 215 | LastUpgradeCheck = 0640; 216 | }; 217 | buildConfigurationList = 35B0B06DCEDAF0C263D5649D /* Build configuration list for PBXProject "Pods" */; 218 | compatibilityVersion = "Xcode 3.2"; 219 | developmentRegion = English; 220 | hasScannedForEncodings = 0; 221 | knownRegions = ( 222 | en, 223 | ); 224 | mainGroup = 17EE5EC6E6722C334CCC0630; 225 | productRefGroup = C378CDDBA905CC2A52F2E389 /* Products */; 226 | projectDirPath = ""; 227 | projectRoot = ""; 228 | targets = ( 229 | 09427C076A21DC0E002EF51F /* Pods */, 230 | AAA02690B64E7B12CCCCB08A /* Pods-MBProgressHUD */, 231 | ); 232 | }; 233 | /* End PBXProject section */ 234 | 235 | /* Begin PBXSourcesBuildPhase section */ 236 | 419BE9083A546025040525EB /* Sources */ = { 237 | isa = PBXSourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ABE7991860E66ECFC6A98572 /* Pods-dummy.m in Sources */, 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | DAE85042296876AA7A12FD8F /* Sources */ = { 245 | isa = PBXSourcesBuildPhase; 246 | buildActionMask = 2147483647; 247 | files = ( 248 | 2CDD6ADCB6E2ED38F01FC3F1 /* MBProgressHUD.m in Sources */, 249 | 82CDF1709D9610231D042285 /* Pods-MBProgressHUD-dummy.m in Sources */, 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | /* End PBXSourcesBuildPhase section */ 254 | 255 | /* Begin PBXTargetDependency section */ 256 | 3337A6ACE1D24F7638E2FBB7 /* PBXTargetDependency */ = { 257 | isa = PBXTargetDependency; 258 | name = "Pods-MBProgressHUD"; 259 | target = AAA02690B64E7B12CCCCB08A /* Pods-MBProgressHUD */; 260 | targetProxy = 8FD11BDC6A8416F7204EBA76 /* PBXContainerItemProxy */; 261 | }; 262 | /* End PBXTargetDependency section */ 263 | 264 | /* Begin XCBuildConfiguration section */ 265 | 10DDB8688A9FC36DE18DF995 /* Release */ = { 266 | isa = XCBuildConfiguration; 267 | baseConfigurationReference = 56A85CCABE84D51CF09ACA0C /* Pods-MBProgressHUD-Private.xcconfig */; 268 | buildSettings = { 269 | ENABLE_STRICT_OBJC_MSGSEND = YES; 270 | GCC_PREFIX_HEADER = "Target Support Files/Pods-MBProgressHUD/Pods-MBProgressHUD-prefix.pch"; 271 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 272 | MTL_ENABLE_DEBUG_INFO = NO; 273 | OTHER_LDFLAGS = ""; 274 | OTHER_LIBTOOLFLAGS = ""; 275 | PRODUCT_NAME = "$(TARGET_NAME)"; 276 | SDKROOT = iphoneos; 277 | SKIP_INSTALL = YES; 278 | }; 279 | name = Release; 280 | }; 281 | 17CD58CEB699AFDC34087459 /* Debug */ = { 282 | isa = XCBuildConfiguration; 283 | buildSettings = { 284 | ALWAYS_SEARCH_USER_PATHS = NO; 285 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 286 | CLANG_CXX_LIBRARY = "libc++"; 287 | CLANG_ENABLE_MODULES = YES; 288 | CLANG_ENABLE_OBJC_ARC = YES; 289 | CLANG_WARN_BOOL_CONVERSION = YES; 290 | CLANG_WARN_CONSTANT_CONVERSION = YES; 291 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 292 | CLANG_WARN_EMPTY_BODY = YES; 293 | CLANG_WARN_ENUM_CONVERSION = YES; 294 | CLANG_WARN_INT_CONVERSION = YES; 295 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 296 | CLANG_WARN_UNREACHABLE_CODE = YES; 297 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 298 | COPY_PHASE_STRIP = NO; 299 | GCC_C_LANGUAGE_STANDARD = gnu99; 300 | GCC_DYNAMIC_NO_PIC = NO; 301 | GCC_OPTIMIZATION_LEVEL = 0; 302 | GCC_PREPROCESSOR_DEFINITIONS = ( 303 | "DEBUG=1", 304 | "$(inherited)", 305 | ); 306 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 307 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 308 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 309 | GCC_WARN_UNDECLARED_SELECTOR = YES; 310 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 311 | GCC_WARN_UNUSED_FUNCTION = YES; 312 | GCC_WARN_UNUSED_VARIABLE = YES; 313 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 314 | ONLY_ACTIVE_ARCH = YES; 315 | STRIP_INSTALLED_PRODUCT = NO; 316 | SYMROOT = "${SRCROOT}/../build"; 317 | }; 318 | name = Debug; 319 | }; 320 | 1A276E9D2AAFA0107A754EC4 /* Release */ = { 321 | isa = XCBuildConfiguration; 322 | baseConfigurationReference = B8DC57464F228EF45A855255 /* Pods.release.xcconfig */; 323 | buildSettings = { 324 | ENABLE_STRICT_OBJC_MSGSEND = YES; 325 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 326 | MTL_ENABLE_DEBUG_INFO = NO; 327 | OTHER_LDFLAGS = ""; 328 | OTHER_LIBTOOLFLAGS = ""; 329 | PODS_ROOT = "$(SRCROOT)"; 330 | PRODUCT_NAME = "$(TARGET_NAME)"; 331 | SDKROOT = iphoneos; 332 | SKIP_INSTALL = YES; 333 | }; 334 | name = Release; 335 | }; 336 | 2AB3D211F6E7A58E2B12A16E /* Release */ = { 337 | isa = XCBuildConfiguration; 338 | buildSettings = { 339 | ALWAYS_SEARCH_USER_PATHS = NO; 340 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 341 | CLANG_CXX_LIBRARY = "libc++"; 342 | CLANG_ENABLE_MODULES = YES; 343 | CLANG_ENABLE_OBJC_ARC = YES; 344 | CLANG_WARN_BOOL_CONVERSION = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INT_CONVERSION = YES; 350 | CLANG_WARN_OBJC_ROOT_CLASS = YES; 351 | CLANG_WARN_UNREACHABLE_CODE = YES; 352 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 353 | COPY_PHASE_STRIP = YES; 354 | ENABLE_NS_ASSERTIONS = NO; 355 | GCC_C_LANGUAGE_STANDARD = gnu99; 356 | GCC_PREPROCESSOR_DEFINITIONS = "RELEASE=1"; 357 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 358 | GCC_WARN_ABOUT_RETURN_TYPE = YES; 359 | GCC_WARN_UNDECLARED_SELECTOR = YES; 360 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 361 | GCC_WARN_UNUSED_FUNCTION = YES; 362 | GCC_WARN_UNUSED_VARIABLE = YES; 363 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 364 | STRIP_INSTALLED_PRODUCT = NO; 365 | SYMROOT = "${SRCROOT}/../build"; 366 | VALIDATE_PRODUCT = YES; 367 | }; 368 | name = Release; 369 | }; 370 | 8EF670C3E394FD9A7C309A69 /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | baseConfigurationReference = D242D1D9265F1FAB5D507740 /* Pods.debug.xcconfig */; 373 | buildSettings = { 374 | ENABLE_STRICT_OBJC_MSGSEND = YES; 375 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 376 | MTL_ENABLE_DEBUG_INFO = YES; 377 | OTHER_LDFLAGS = ""; 378 | OTHER_LIBTOOLFLAGS = ""; 379 | PODS_ROOT = "$(SRCROOT)"; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | SDKROOT = iphoneos; 382 | SKIP_INSTALL = YES; 383 | }; 384 | name = Debug; 385 | }; 386 | A11B1A518E9A460476DF3E42 /* Debug */ = { 387 | isa = XCBuildConfiguration; 388 | baseConfigurationReference = 56A85CCABE84D51CF09ACA0C /* Pods-MBProgressHUD-Private.xcconfig */; 389 | buildSettings = { 390 | ENABLE_STRICT_OBJC_MSGSEND = YES; 391 | GCC_PREFIX_HEADER = "Target Support Files/Pods-MBProgressHUD/Pods-MBProgressHUD-prefix.pch"; 392 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 393 | MTL_ENABLE_DEBUG_INFO = YES; 394 | OTHER_LDFLAGS = ""; 395 | OTHER_LIBTOOLFLAGS = ""; 396 | PRODUCT_NAME = "$(TARGET_NAME)"; 397 | SDKROOT = iphoneos; 398 | SKIP_INSTALL = YES; 399 | }; 400 | name = Debug; 401 | }; 402 | /* End XCBuildConfiguration section */ 403 | 404 | /* Begin XCConfigurationList section */ 405 | 35B0B06DCEDAF0C263D5649D /* Build configuration list for PBXProject "Pods" */ = { 406 | isa = XCConfigurationList; 407 | buildConfigurations = ( 408 | 17CD58CEB699AFDC34087459 /* Debug */, 409 | 2AB3D211F6E7A58E2B12A16E /* Release */, 410 | ); 411 | defaultConfigurationIsVisible = 0; 412 | defaultConfigurationName = Release; 413 | }; 414 | 449ECEE9AF2063DFEED6BA28 /* Build configuration list for PBXNativeTarget "Pods-MBProgressHUD" */ = { 415 | isa = XCConfigurationList; 416 | buildConfigurations = ( 417 | A11B1A518E9A460476DF3E42 /* Debug */, 418 | 10DDB8688A9FC36DE18DF995 /* Release */, 419 | ); 420 | defaultConfigurationIsVisible = 0; 421 | defaultConfigurationName = Release; 422 | }; 423 | 4F77E3AC1C5CDA9C31F79E65 /* Build configuration list for PBXNativeTarget "Pods" */ = { 424 | isa = XCConfigurationList; 425 | buildConfigurations = ( 426 | 8EF670C3E394FD9A7C309A69 /* Debug */, 427 | 1A276E9D2AAFA0107A754EC4 /* Release */, 428 | ); 429 | defaultConfigurationIsVisible = 0; 430 | defaultConfigurationName = Release; 431 | }; 432 | /* End XCConfigurationList section */ 433 | }; 434 | rootObject = F6198E1D81B78EE00FA747AD /* Project object */; 435 | } 436 | -------------------------------------------------------------------------------- /BeginCLLocationOC/BeginCLLocationOC.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 125A8CE15F40D8E6F3DCA1E8 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = EBD3A473D85B57B0B9BC6A74 /* libPods.a */; }; 11 | CAAF9C491B712FCB002202A9 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = CAAF9C481B712FCB002202A9 /* main.m */; }; 12 | CAAF9C4C1B712FCB002202A9 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = CAAF9C4B1B712FCB002202A9 /* AppDelegate.m */; }; 13 | CAAF9C4F1B712FCB002202A9 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CAAF9C4E1B712FCB002202A9 /* ViewController.m */; }; 14 | CAAF9C521B712FCB002202A9 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CAAF9C501B712FCB002202A9 /* Main.storyboard */; }; 15 | CAAF9C541B712FCB002202A9 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CAAF9C531B712FCB002202A9 /* Images.xcassets */; }; 16 | CAAF9C571B712FCB002202A9 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = CAAF9C551B712FCB002202A9 /* LaunchScreen.xib */; }; 17 | CAAF9C631B712FCB002202A9 /* BeginCLLocationOCTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CAAF9C621B712FCB002202A9 /* BeginCLLocationOCTests.m */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | CAAF9C5D1B712FCB002202A9 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = CAAF9C3B1B712FCB002202A9 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = CAAF9C421B712FCB002202A9; 26 | remoteInfo = BeginCLLocationOC; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | 4A0BA6CB4B66A2570305A49D /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 32 | 796DD69777A20A898291BBDA /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = ""; }; 33 | CAAF9C431B712FCB002202A9 /* BeginCLLocationOC.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BeginCLLocationOC.app; sourceTree = BUILT_PRODUCTS_DIR; }; 34 | CAAF9C471B712FCB002202A9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 35 | CAAF9C481B712FCB002202A9 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 36 | CAAF9C4A1B712FCB002202A9 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 37 | CAAF9C4B1B712FCB002202A9 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 38 | CAAF9C4D1B712FCB002202A9 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 39 | CAAF9C4E1B712FCB002202A9 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 40 | CAAF9C511B712FCB002202A9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | CAAF9C531B712FCB002202A9 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | CAAF9C561B712FCB002202A9 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | CAAF9C5C1B712FCB002202A9 /* BeginCLLocationOCTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BeginCLLocationOCTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | CAAF9C611B712FCB002202A9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | CAAF9C621B712FCB002202A9 /* BeginCLLocationOCTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BeginCLLocationOCTests.m; sourceTree = ""; }; 46 | EBD3A473D85B57B0B9BC6A74 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | /* End PBXFileReference section */ 48 | 49 | /* Begin PBXFrameworksBuildPhase section */ 50 | CAAF9C401B712FCB002202A9 /* Frameworks */ = { 51 | isa = PBXFrameworksBuildPhase; 52 | buildActionMask = 2147483647; 53 | files = ( 54 | 125A8CE15F40D8E6F3DCA1E8 /* libPods.a in Frameworks */, 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | CAAF9C591B712FCB002202A9 /* Frameworks */ = { 59 | isa = PBXFrameworksBuildPhase; 60 | buildActionMask = 2147483647; 61 | files = ( 62 | ); 63 | runOnlyForDeploymentPostprocessing = 0; 64 | }; 65 | /* End PBXFrameworksBuildPhase section */ 66 | 67 | /* Begin PBXGroup section */ 68 | 4266ED9A08971BDB34B1F7AD /* Pods */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | 4A0BA6CB4B66A2570305A49D /* Pods.debug.xcconfig */, 72 | 796DD69777A20A898291BBDA /* Pods.release.xcconfig */, 73 | ); 74 | name = Pods; 75 | sourceTree = ""; 76 | }; 77 | CA53E89E1B719A070026029A /* Classes */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | CA53E8A11B719A200026029A /* Other */, 81 | CA53E89F1B719A0F0026029A /* Controller */, 82 | ); 83 | name = Classes; 84 | sourceTree = ""; 85 | }; 86 | CA53E89F1B719A0F0026029A /* Controller */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | CAAF9C4D1B712FCB002202A9 /* ViewController.h */, 90 | CAAF9C4E1B712FCB002202A9 /* ViewController.m */, 91 | ); 92 | name = Controller; 93 | sourceTree = ""; 94 | }; 95 | CA53E8A11B719A200026029A /* Other */ = { 96 | isa = PBXGroup; 97 | children = ( 98 | CAAF9C4A1B712FCB002202A9 /* AppDelegate.h */, 99 | CAAF9C4B1B712FCB002202A9 /* AppDelegate.m */, 100 | ); 101 | name = Other; 102 | sourceTree = ""; 103 | }; 104 | CAAF9C3A1B712FCB002202A9 = { 105 | isa = PBXGroup; 106 | children = ( 107 | CAAF9C451B712FCB002202A9 /* BeginCLLocationOC */, 108 | CAAF9C5F1B712FCB002202A9 /* BeginCLLocationOCTests */, 109 | CAAF9C441B712FCB002202A9 /* Products */, 110 | 4266ED9A08971BDB34B1F7AD /* Pods */, 111 | D7D945DA2EB1AC7F977D4D2C /* Frameworks */, 112 | ); 113 | sourceTree = ""; 114 | }; 115 | CAAF9C441B712FCB002202A9 /* Products */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | CAAF9C431B712FCB002202A9 /* BeginCLLocationOC.app */, 119 | CAAF9C5C1B712FCB002202A9 /* BeginCLLocationOCTests.xctest */, 120 | ); 121 | name = Products; 122 | sourceTree = ""; 123 | }; 124 | CAAF9C451B712FCB002202A9 /* BeginCLLocationOC */ = { 125 | isa = PBXGroup; 126 | children = ( 127 | CA53E89E1B719A070026029A /* Classes */, 128 | CAAF9C461B712FCB002202A9 /* Supporting Files */, 129 | ); 130 | path = BeginCLLocationOC; 131 | sourceTree = ""; 132 | }; 133 | CAAF9C461B712FCB002202A9 /* Supporting Files */ = { 134 | isa = PBXGroup; 135 | children = ( 136 | CAAF9C501B712FCB002202A9 /* Main.storyboard */, 137 | CAAF9C531B712FCB002202A9 /* Images.xcassets */, 138 | CAAF9C551B712FCB002202A9 /* LaunchScreen.xib */, 139 | CAAF9C471B712FCB002202A9 /* Info.plist */, 140 | CAAF9C481B712FCB002202A9 /* main.m */, 141 | ); 142 | name = "Supporting Files"; 143 | sourceTree = ""; 144 | }; 145 | CAAF9C5F1B712FCB002202A9 /* BeginCLLocationOCTests */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | CAAF9C621B712FCB002202A9 /* BeginCLLocationOCTests.m */, 149 | CAAF9C601B712FCB002202A9 /* Supporting Files */, 150 | ); 151 | path = BeginCLLocationOCTests; 152 | sourceTree = ""; 153 | }; 154 | CAAF9C601B712FCB002202A9 /* Supporting Files */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | CAAF9C611B712FCB002202A9 /* Info.plist */, 158 | ); 159 | name = "Supporting Files"; 160 | sourceTree = ""; 161 | }; 162 | D7D945DA2EB1AC7F977D4D2C /* Frameworks */ = { 163 | isa = PBXGroup; 164 | children = ( 165 | EBD3A473D85B57B0B9BC6A74 /* libPods.a */, 166 | ); 167 | name = Frameworks; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXGroup section */ 171 | 172 | /* Begin PBXNativeTarget section */ 173 | CAAF9C421B712FCB002202A9 /* BeginCLLocationOC */ = { 174 | isa = PBXNativeTarget; 175 | buildConfigurationList = CAAF9C661B712FCB002202A9 /* Build configuration list for PBXNativeTarget "BeginCLLocationOC" */; 176 | buildPhases = ( 177 | B64D6126684C79A6C99B0FE5 /* Check Pods Manifest.lock */, 178 | CAAF9C3F1B712FCB002202A9 /* Sources */, 179 | CAAF9C401B712FCB002202A9 /* Frameworks */, 180 | CAAF9C411B712FCB002202A9 /* Resources */, 181 | D7D5659D5309D9F27FCD6826 /* Copy Pods Resources */, 182 | ); 183 | buildRules = ( 184 | ); 185 | dependencies = ( 186 | ); 187 | name = BeginCLLocationOC; 188 | productName = BeginCLLocationOC; 189 | productReference = CAAF9C431B712FCB002202A9 /* BeginCLLocationOC.app */; 190 | productType = "com.apple.product-type.application"; 191 | }; 192 | CAAF9C5B1B712FCB002202A9 /* BeginCLLocationOCTests */ = { 193 | isa = PBXNativeTarget; 194 | buildConfigurationList = CAAF9C691B712FCB002202A9 /* Build configuration list for PBXNativeTarget "BeginCLLocationOCTests" */; 195 | buildPhases = ( 196 | CAAF9C581B712FCB002202A9 /* Sources */, 197 | CAAF9C591B712FCB002202A9 /* Frameworks */, 198 | CAAF9C5A1B712FCB002202A9 /* Resources */, 199 | ); 200 | buildRules = ( 201 | ); 202 | dependencies = ( 203 | CAAF9C5E1B712FCB002202A9 /* PBXTargetDependency */, 204 | ); 205 | name = BeginCLLocationOCTests; 206 | productName = BeginCLLocationOCTests; 207 | productReference = CAAF9C5C1B712FCB002202A9 /* BeginCLLocationOCTests.xctest */; 208 | productType = "com.apple.product-type.bundle.unit-test"; 209 | }; 210 | /* End PBXNativeTarget section */ 211 | 212 | /* Begin PBXProject section */ 213 | CAAF9C3B1B712FCB002202A9 /* Project object */ = { 214 | isa = PBXProject; 215 | attributes = { 216 | LastUpgradeCheck = 0640; 217 | ORGANIZATIONNAME = wamaker; 218 | TargetAttributes = { 219 | CAAF9C421B712FCB002202A9 = { 220 | CreatedOnToolsVersion = 6.4; 221 | }; 222 | CAAF9C5B1B712FCB002202A9 = { 223 | CreatedOnToolsVersion = 6.4; 224 | TestTargetID = CAAF9C421B712FCB002202A9; 225 | }; 226 | }; 227 | }; 228 | buildConfigurationList = CAAF9C3E1B712FCB002202A9 /* Build configuration list for PBXProject "BeginCLLocationOC" */; 229 | compatibilityVersion = "Xcode 3.2"; 230 | developmentRegion = English; 231 | hasScannedForEncodings = 0; 232 | knownRegions = ( 233 | en, 234 | Base, 235 | ); 236 | mainGroup = CAAF9C3A1B712FCB002202A9; 237 | productRefGroup = CAAF9C441B712FCB002202A9 /* Products */; 238 | projectDirPath = ""; 239 | projectRoot = ""; 240 | targets = ( 241 | CAAF9C421B712FCB002202A9 /* BeginCLLocationOC */, 242 | CAAF9C5B1B712FCB002202A9 /* BeginCLLocationOCTests */, 243 | ); 244 | }; 245 | /* End PBXProject section */ 246 | 247 | /* Begin PBXResourcesBuildPhase section */ 248 | CAAF9C411B712FCB002202A9 /* Resources */ = { 249 | isa = PBXResourcesBuildPhase; 250 | buildActionMask = 2147483647; 251 | files = ( 252 | CAAF9C521B712FCB002202A9 /* Main.storyboard in Resources */, 253 | CAAF9C571B712FCB002202A9 /* LaunchScreen.xib in Resources */, 254 | CAAF9C541B712FCB002202A9 /* Images.xcassets in Resources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | CAAF9C5A1B712FCB002202A9 /* Resources */ = { 259 | isa = PBXResourcesBuildPhase; 260 | buildActionMask = 2147483647; 261 | files = ( 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | /* End PBXResourcesBuildPhase section */ 266 | 267 | /* Begin PBXShellScriptBuildPhase section */ 268 | B64D6126684C79A6C99B0FE5 /* Check Pods Manifest.lock */ = { 269 | isa = PBXShellScriptBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | ); 273 | inputPaths = ( 274 | ); 275 | name = "Check Pods Manifest.lock"; 276 | outputPaths = ( 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | shellPath = /bin/sh; 280 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; 281 | showEnvVarsInLog = 0; 282 | }; 283 | D7D5659D5309D9F27FCD6826 /* Copy Pods Resources */ = { 284 | isa = PBXShellScriptBuildPhase; 285 | buildActionMask = 2147483647; 286 | files = ( 287 | ); 288 | inputPaths = ( 289 | ); 290 | name = "Copy Pods Resources"; 291 | outputPaths = ( 292 | ); 293 | runOnlyForDeploymentPostprocessing = 0; 294 | shellPath = /bin/sh; 295 | shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods/Pods-resources.sh\"\n"; 296 | showEnvVarsInLog = 0; 297 | }; 298 | /* End PBXShellScriptBuildPhase section */ 299 | 300 | /* Begin PBXSourcesBuildPhase section */ 301 | CAAF9C3F1B712FCB002202A9 /* Sources */ = { 302 | isa = PBXSourcesBuildPhase; 303 | buildActionMask = 2147483647; 304 | files = ( 305 | CAAF9C4F1B712FCB002202A9 /* ViewController.m in Sources */, 306 | CAAF9C4C1B712FCB002202A9 /* AppDelegate.m in Sources */, 307 | CAAF9C491B712FCB002202A9 /* main.m in Sources */, 308 | ); 309 | runOnlyForDeploymentPostprocessing = 0; 310 | }; 311 | CAAF9C581B712FCB002202A9 /* Sources */ = { 312 | isa = PBXSourcesBuildPhase; 313 | buildActionMask = 2147483647; 314 | files = ( 315 | CAAF9C631B712FCB002202A9 /* BeginCLLocationOCTests.m in Sources */, 316 | ); 317 | runOnlyForDeploymentPostprocessing = 0; 318 | }; 319 | /* End PBXSourcesBuildPhase section */ 320 | 321 | /* Begin PBXTargetDependency section */ 322 | CAAF9C5E1B712FCB002202A9 /* PBXTargetDependency */ = { 323 | isa = PBXTargetDependency; 324 | target = CAAF9C421B712FCB002202A9 /* BeginCLLocationOC */; 325 | targetProxy = CAAF9C5D1B712FCB002202A9 /* PBXContainerItemProxy */; 326 | }; 327 | /* End PBXTargetDependency section */ 328 | 329 | /* Begin PBXVariantGroup section */ 330 | CAAF9C501B712FCB002202A9 /* Main.storyboard */ = { 331 | isa = PBXVariantGroup; 332 | children = ( 333 | CAAF9C511B712FCB002202A9 /* Base */, 334 | ); 335 | name = Main.storyboard; 336 | sourceTree = ""; 337 | }; 338 | CAAF9C551B712FCB002202A9 /* LaunchScreen.xib */ = { 339 | isa = PBXVariantGroup; 340 | children = ( 341 | CAAF9C561B712FCB002202A9 /* Base */, 342 | ); 343 | name = LaunchScreen.xib; 344 | sourceTree = ""; 345 | }; 346 | /* End PBXVariantGroup section */ 347 | 348 | /* Begin XCBuildConfiguration section */ 349 | CAAF9C641B712FCB002202A9 /* Debug */ = { 350 | isa = XCBuildConfiguration; 351 | buildSettings = { 352 | ALWAYS_SEARCH_USER_PATHS = NO; 353 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 354 | CLANG_CXX_LIBRARY = "libc++"; 355 | CLANG_ENABLE_MODULES = YES; 356 | CLANG_ENABLE_OBJC_ARC = YES; 357 | CLANG_WARN_BOOL_CONVERSION = YES; 358 | CLANG_WARN_CONSTANT_CONVERSION = YES; 359 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 360 | CLANG_WARN_EMPTY_BODY = YES; 361 | CLANG_WARN_ENUM_CONVERSION = YES; 362 | CLANG_WARN_INT_CONVERSION = YES; 363 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 364 | CLANG_WARN_UNREACHABLE_CODE = YES; 365 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 366 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 367 | COPY_PHASE_STRIP = NO; 368 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 369 | ENABLE_STRICT_OBJC_MSGSEND = YES; 370 | GCC_C_LANGUAGE_STANDARD = gnu99; 371 | GCC_DYNAMIC_NO_PIC = NO; 372 | GCC_NO_COMMON_BLOCKS = YES; 373 | GCC_OPTIMIZATION_LEVEL = 0; 374 | GCC_PREPROCESSOR_DEFINITIONS = ( 375 | "DEBUG=1", 376 | "$(inherited)", 377 | ); 378 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 379 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 380 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 381 | GCC_WARN_UNDECLARED_SELECTOR = YES; 382 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 383 | GCC_WARN_UNUSED_FUNCTION = YES; 384 | GCC_WARN_UNUSED_VARIABLE = YES; 385 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 386 | MTL_ENABLE_DEBUG_INFO = YES; 387 | ONLY_ACTIVE_ARCH = YES; 388 | SDKROOT = iphoneos; 389 | }; 390 | name = Debug; 391 | }; 392 | CAAF9C651B712FCB002202A9 /* Release */ = { 393 | isa = XCBuildConfiguration; 394 | buildSettings = { 395 | ALWAYS_SEARCH_USER_PATHS = NO; 396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 397 | CLANG_CXX_LIBRARY = "libc++"; 398 | CLANG_ENABLE_MODULES = YES; 399 | CLANG_ENABLE_OBJC_ARC = YES; 400 | CLANG_WARN_BOOL_CONVERSION = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 403 | CLANG_WARN_EMPTY_BODY = YES; 404 | CLANG_WARN_ENUM_CONVERSION = YES; 405 | CLANG_WARN_INT_CONVERSION = YES; 406 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 407 | CLANG_WARN_UNREACHABLE_CODE = YES; 408 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 409 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 410 | COPY_PHASE_STRIP = NO; 411 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 412 | ENABLE_NS_ASSERTIONS = NO; 413 | ENABLE_STRICT_OBJC_MSGSEND = YES; 414 | GCC_C_LANGUAGE_STANDARD = gnu99; 415 | GCC_NO_COMMON_BLOCKS = YES; 416 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 417 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 418 | GCC_WARN_UNDECLARED_SELECTOR = YES; 419 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 420 | GCC_WARN_UNUSED_FUNCTION = YES; 421 | GCC_WARN_UNUSED_VARIABLE = YES; 422 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 423 | MTL_ENABLE_DEBUG_INFO = NO; 424 | SDKROOT = iphoneos; 425 | VALIDATE_PRODUCT = YES; 426 | }; 427 | name = Release; 428 | }; 429 | CAAF9C671B712FCB002202A9 /* Debug */ = { 430 | isa = XCBuildConfiguration; 431 | baseConfigurationReference = 4A0BA6CB4B66A2570305A49D /* Pods.debug.xcconfig */; 432 | buildSettings = { 433 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 434 | INFOPLIST_FILE = BeginCLLocationOC/Info.plist; 435 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 436 | PRODUCT_NAME = "$(TARGET_NAME)"; 437 | USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; 438 | }; 439 | name = Debug; 440 | }; 441 | CAAF9C681B712FCB002202A9 /* Release */ = { 442 | isa = XCBuildConfiguration; 443 | baseConfigurationReference = 796DD69777A20A898291BBDA /* Pods.release.xcconfig */; 444 | buildSettings = { 445 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 446 | INFOPLIST_FILE = BeginCLLocationOC/Info.plist; 447 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 448 | PRODUCT_NAME = "$(TARGET_NAME)"; 449 | USER_HEADER_SEARCH_PATHS = "${SRCROOT}/**"; 450 | }; 451 | name = Release; 452 | }; 453 | CAAF9C6A1B712FCB002202A9 /* Debug */ = { 454 | isa = XCBuildConfiguration; 455 | buildSettings = { 456 | BUNDLE_LOADER = "$(TEST_HOST)"; 457 | FRAMEWORK_SEARCH_PATHS = ( 458 | "$(SDKROOT)/Developer/Library/Frameworks", 459 | "$(inherited)", 460 | ); 461 | GCC_PREPROCESSOR_DEFINITIONS = ( 462 | "DEBUG=1", 463 | "$(inherited)", 464 | ); 465 | INFOPLIST_FILE = BeginCLLocationOCTests/Info.plist; 466 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 467 | PRODUCT_NAME = "$(TARGET_NAME)"; 468 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BeginCLLocationOC.app/BeginCLLocationOC"; 469 | }; 470 | name = Debug; 471 | }; 472 | CAAF9C6B1B712FCB002202A9 /* Release */ = { 473 | isa = XCBuildConfiguration; 474 | buildSettings = { 475 | BUNDLE_LOADER = "$(TEST_HOST)"; 476 | FRAMEWORK_SEARCH_PATHS = ( 477 | "$(SDKROOT)/Developer/Library/Frameworks", 478 | "$(inherited)", 479 | ); 480 | INFOPLIST_FILE = BeginCLLocationOCTests/Info.plist; 481 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 482 | PRODUCT_NAME = "$(TARGET_NAME)"; 483 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BeginCLLocationOC.app/BeginCLLocationOC"; 484 | }; 485 | name = Release; 486 | }; 487 | /* End XCBuildConfiguration section */ 488 | 489 | /* Begin XCConfigurationList section */ 490 | CAAF9C3E1B712FCB002202A9 /* Build configuration list for PBXProject "BeginCLLocationOC" */ = { 491 | isa = XCConfigurationList; 492 | buildConfigurations = ( 493 | CAAF9C641B712FCB002202A9 /* Debug */, 494 | CAAF9C651B712FCB002202A9 /* Release */, 495 | ); 496 | defaultConfigurationIsVisible = 0; 497 | defaultConfigurationName = Release; 498 | }; 499 | CAAF9C661B712FCB002202A9 /* Build configuration list for PBXNativeTarget "BeginCLLocationOC" */ = { 500 | isa = XCConfigurationList; 501 | buildConfigurations = ( 502 | CAAF9C671B712FCB002202A9 /* Debug */, 503 | CAAF9C681B712FCB002202A9 /* Release */, 504 | ); 505 | defaultConfigurationIsVisible = 0; 506 | defaultConfigurationName = Release; 507 | }; 508 | CAAF9C691B712FCB002202A9 /* Build configuration list for PBXNativeTarget "BeginCLLocationOCTests" */ = { 509 | isa = XCConfigurationList; 510 | buildConfigurations = ( 511 | CAAF9C6A1B712FCB002202A9 /* Debug */, 512 | CAAF9C6B1B712FCB002202A9 /* Release */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | defaultConfigurationName = Release; 516 | }; 517 | /* End XCConfigurationList section */ 518 | }; 519 | rootObject = CAAF9C3B1B712FCB002202A9 /* Project object */; 520 | } 521 | -------------------------------------------------------------------------------- /BeginCLLocationOC/Pods/MBProgressHUD/MBProgressHUD.m: -------------------------------------------------------------------------------- 1 | // 2 | // MBProgressHUD.m 3 | // Version 0.9.1 4 | // Created by Matej Bukovinski on 2.4.09. 5 | // 6 | 7 | #import "MBProgressHUD.h" 8 | #import 9 | 10 | 11 | #if __has_feature(objc_arc) 12 | #define MB_AUTORELEASE(exp) exp 13 | #define MB_RELEASE(exp) exp 14 | #define MB_RETAIN(exp) exp 15 | #else 16 | #define MB_AUTORELEASE(exp) [exp autorelease] 17 | #define MB_RELEASE(exp) [exp release] 18 | #define MB_RETAIN(exp) [exp retain] 19 | #endif 20 | 21 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 22 | #define MBLabelAlignmentCenter NSTextAlignmentCenter 23 | #else 24 | #define MBLabelAlignmentCenter UITextAlignmentCenter 25 | #endif 26 | 27 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 28 | #define MB_TEXTSIZE(text, font) [text length] > 0 ? [text \ 29 | sizeWithAttributes:@{NSFontAttributeName:font}] : CGSizeZero; 30 | #else 31 | #define MB_TEXTSIZE(text, font) [text length] > 0 ? [text sizeWithFont:font] : CGSizeZero; 32 | #endif 33 | 34 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 35 | #define MB_MULTILINE_TEXTSIZE(text, font, maxSize, mode) [text length] > 0 ? [text \ 36 | boundingRectWithSize:maxSize options:(NSStringDrawingUsesLineFragmentOrigin) \ 37 | attributes:@{NSFontAttributeName:font} context:nil].size : CGSizeZero; 38 | #else 39 | #define MB_MULTILINE_TEXTSIZE(text, font, maxSize, mode) [text length] > 0 ? [text \ 40 | sizeWithFont:font constrainedToSize:maxSize lineBreakMode:mode] : CGSizeZero; 41 | #endif 42 | 43 | #ifndef kCFCoreFoundationVersionNumber_iOS_7_0 44 | #define kCFCoreFoundationVersionNumber_iOS_7_0 847.20 45 | #endif 46 | 47 | #ifndef kCFCoreFoundationVersionNumber_iOS_8_0 48 | #define kCFCoreFoundationVersionNumber_iOS_8_0 1129.15 49 | #endif 50 | 51 | 52 | static const CGFloat kPadding = 4.f; 53 | static const CGFloat kLabelFontSize = 16.f; 54 | static const CGFloat kDetailsLabelFontSize = 12.f; 55 | 56 | 57 | @interface MBProgressHUD () { 58 | BOOL useAnimation; 59 | SEL methodForExecution; 60 | id targetForExecution; 61 | id objectForExecution; 62 | UILabel *label; 63 | UILabel *detailsLabel; 64 | BOOL isFinished; 65 | CGAffineTransform rotationTransform; 66 | } 67 | 68 | @property (atomic, MB_STRONG) UIView *indicator; 69 | @property (atomic, MB_STRONG) NSTimer *graceTimer; 70 | @property (atomic, MB_STRONG) NSTimer *minShowTimer; 71 | @property (atomic, MB_STRONG) NSDate *showStarted; 72 | 73 | @end 74 | 75 | 76 | @implementation MBProgressHUD 77 | 78 | #pragma mark - Properties 79 | 80 | @synthesize animationType; 81 | @synthesize delegate; 82 | @synthesize opacity; 83 | @synthesize color; 84 | @synthesize labelFont; 85 | @synthesize labelColor; 86 | @synthesize detailsLabelFont; 87 | @synthesize detailsLabelColor; 88 | @synthesize indicator; 89 | @synthesize xOffset; 90 | @synthesize yOffset; 91 | @synthesize minSize; 92 | @synthesize square; 93 | @synthesize margin; 94 | @synthesize dimBackground; 95 | @synthesize graceTime; 96 | @synthesize minShowTime; 97 | @synthesize graceTimer; 98 | @synthesize minShowTimer; 99 | @synthesize taskInProgress; 100 | @synthesize removeFromSuperViewOnHide; 101 | @synthesize customView; 102 | @synthesize showStarted; 103 | @synthesize mode; 104 | @synthesize labelText; 105 | @synthesize detailsLabelText; 106 | @synthesize progress; 107 | @synthesize size; 108 | @synthesize activityIndicatorColor; 109 | #if NS_BLOCKS_AVAILABLE 110 | @synthesize completionBlock; 111 | #endif 112 | 113 | #pragma mark - Class methods 114 | 115 | + (MB_INSTANCETYPE)showHUDAddedTo:(UIView *)view animated:(BOOL)animated { 116 | MBProgressHUD *hud = [[self alloc] initWithView:view]; 117 | hud.removeFromSuperViewOnHide = YES; 118 | [view addSubview:hud]; 119 | [hud show:animated]; 120 | return MB_AUTORELEASE(hud); 121 | } 122 | 123 | + (BOOL)hideHUDForView:(UIView *)view animated:(BOOL)animated { 124 | MBProgressHUD *hud = [self HUDForView:view]; 125 | if (hud != nil) { 126 | hud.removeFromSuperViewOnHide = YES; 127 | [hud hide:animated]; 128 | return YES; 129 | } 130 | return NO; 131 | } 132 | 133 | + (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated { 134 | NSArray *huds = [MBProgressHUD allHUDsForView:view]; 135 | for (MBProgressHUD *hud in huds) { 136 | hud.removeFromSuperViewOnHide = YES; 137 | [hud hide:animated]; 138 | } 139 | return [huds count]; 140 | } 141 | 142 | + (MB_INSTANCETYPE)HUDForView:(UIView *)view { 143 | NSEnumerator *subviewsEnum = [view.subviews reverseObjectEnumerator]; 144 | for (UIView *subview in subviewsEnum) { 145 | if ([subview isKindOfClass:self]) { 146 | return (MBProgressHUD *)subview; 147 | } 148 | } 149 | return nil; 150 | } 151 | 152 | + (NSArray *)allHUDsForView:(UIView *)view { 153 | NSMutableArray *huds = [NSMutableArray array]; 154 | NSArray *subviews = view.subviews; 155 | for (UIView *aView in subviews) { 156 | if ([aView isKindOfClass:self]) { 157 | [huds addObject:aView]; 158 | } 159 | } 160 | return [NSArray arrayWithArray:huds]; 161 | } 162 | 163 | #pragma mark - Lifecycle 164 | 165 | - (id)initWithFrame:(CGRect)frame { 166 | self = [super initWithFrame:frame]; 167 | if (self) { 168 | // Set default values for properties 169 | self.animationType = MBProgressHUDAnimationFade; 170 | self.mode = MBProgressHUDModeIndeterminate; 171 | self.labelText = nil; 172 | self.detailsLabelText = nil; 173 | self.opacity = 0.8f; 174 | self.color = nil; 175 | self.labelFont = [UIFont boldSystemFontOfSize:kLabelFontSize]; 176 | self.labelColor = [UIColor whiteColor]; 177 | self.detailsLabelFont = [UIFont boldSystemFontOfSize:kDetailsLabelFontSize]; 178 | self.detailsLabelColor = [UIColor whiteColor]; 179 | self.activityIndicatorColor = [UIColor whiteColor]; 180 | self.xOffset = 0.0f; 181 | self.yOffset = 0.0f; 182 | self.dimBackground = NO; 183 | self.margin = 20.0f; 184 | self.cornerRadius = 10.0f; 185 | self.graceTime = 0.0f; 186 | self.minShowTime = 0.0f; 187 | self.removeFromSuperViewOnHide = NO; 188 | self.minSize = CGSizeZero; 189 | self.square = NO; 190 | self.contentMode = UIViewContentModeCenter; 191 | self.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin 192 | | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; 193 | 194 | // Transparent background 195 | self.opaque = NO; 196 | self.backgroundColor = [UIColor clearColor]; 197 | // Make it invisible for now 198 | self.alpha = 0.0f; 199 | 200 | taskInProgress = NO; 201 | rotationTransform = CGAffineTransformIdentity; 202 | 203 | [self setupLabels]; 204 | [self updateIndicators]; 205 | [self registerForKVO]; 206 | [self registerForNotifications]; 207 | } 208 | return self; 209 | } 210 | 211 | - (id)initWithView:(UIView *)view { 212 | NSAssert(view, @"View must not be nil."); 213 | return [self initWithFrame:view.bounds]; 214 | } 215 | 216 | - (id)initWithWindow:(UIWindow *)window { 217 | return [self initWithView:window]; 218 | } 219 | 220 | - (void)dealloc { 221 | [self unregisterFromNotifications]; 222 | [self unregisterFromKVO]; 223 | #if !__has_feature(objc_arc) 224 | [color release]; 225 | [indicator release]; 226 | [label release]; 227 | [detailsLabel release]; 228 | [labelText release]; 229 | [detailsLabelText release]; 230 | [graceTimer release]; 231 | [minShowTimer release]; 232 | [showStarted release]; 233 | [customView release]; 234 | [labelFont release]; 235 | [labelColor release]; 236 | [detailsLabelFont release]; 237 | [detailsLabelColor release]; 238 | #if NS_BLOCKS_AVAILABLE 239 | [completionBlock release]; 240 | #endif 241 | [super dealloc]; 242 | #endif 243 | } 244 | 245 | #pragma mark - Show & hide 246 | 247 | - (void)show:(BOOL)animated { 248 | useAnimation = animated; 249 | // If the grace time is set postpone the HUD display 250 | if (self.graceTime > 0.0) { 251 | self.graceTimer = [NSTimer scheduledTimerWithTimeInterval:self.graceTime target:self 252 | selector:@selector(handleGraceTimer:) userInfo:nil repeats:NO]; 253 | } 254 | // ... otherwise show the HUD imediately 255 | else { 256 | [self showUsingAnimation:useAnimation]; 257 | } 258 | } 259 | 260 | - (void)hide:(BOOL)animated { 261 | useAnimation = animated; 262 | // If the minShow time is set, calculate how long the hud was shown, 263 | // and pospone the hiding operation if necessary 264 | if (self.minShowTime > 0.0 && showStarted) { 265 | NSTimeInterval interv = [[NSDate date] timeIntervalSinceDate:showStarted]; 266 | if (interv < self.minShowTime) { 267 | self.minShowTimer = [NSTimer scheduledTimerWithTimeInterval:(self.minShowTime - interv) target:self 268 | selector:@selector(handleMinShowTimer:) userInfo:nil repeats:NO]; 269 | return; 270 | } 271 | } 272 | // ... otherwise hide the HUD immediately 273 | [self hideUsingAnimation:useAnimation]; 274 | } 275 | 276 | - (void)hide:(BOOL)animated afterDelay:(NSTimeInterval)delay { 277 | [self performSelector:@selector(hideDelayed:) withObject:[NSNumber numberWithBool:animated] afterDelay:delay]; 278 | } 279 | 280 | - (void)hideDelayed:(NSNumber *)animated { 281 | [self hide:[animated boolValue]]; 282 | } 283 | 284 | #pragma mark - Timer callbacks 285 | 286 | - (void)handleGraceTimer:(NSTimer *)theTimer { 287 | // Show the HUD only if the task is still running 288 | if (taskInProgress) { 289 | [self showUsingAnimation:useAnimation]; 290 | } 291 | } 292 | 293 | - (void)handleMinShowTimer:(NSTimer *)theTimer { 294 | [self hideUsingAnimation:useAnimation]; 295 | } 296 | 297 | #pragma mark - View Hierrarchy 298 | 299 | - (void)didMoveToSuperview { 300 | [self updateForCurrentOrientationAnimated:NO]; 301 | } 302 | 303 | #pragma mark - Internal show & hide operations 304 | 305 | - (void)showUsingAnimation:(BOOL)animated { 306 | // Cancel any scheduled hideDelayed: calls 307 | [NSObject cancelPreviousPerformRequestsWithTarget:self]; 308 | [self setNeedsDisplay]; 309 | 310 | if (animated && animationType == MBProgressHUDAnimationZoomIn) { 311 | self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(0.5f, 0.5f)); 312 | } else if (animated && animationType == MBProgressHUDAnimationZoomOut) { 313 | self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(1.5f, 1.5f)); 314 | } 315 | self.showStarted = [NSDate date]; 316 | // Fade in 317 | if (animated) { 318 | [UIView beginAnimations:nil context:NULL]; 319 | [UIView setAnimationDuration:0.30]; 320 | self.alpha = 1.0f; 321 | if (animationType == MBProgressHUDAnimationZoomIn || animationType == MBProgressHUDAnimationZoomOut) { 322 | self.transform = rotationTransform; 323 | } 324 | [UIView commitAnimations]; 325 | } 326 | else { 327 | self.alpha = 1.0f; 328 | } 329 | } 330 | 331 | - (void)hideUsingAnimation:(BOOL)animated { 332 | // Fade out 333 | if (animated && showStarted) { 334 | [UIView beginAnimations:nil context:NULL]; 335 | [UIView setAnimationDuration:0.30]; 336 | [UIView setAnimationDelegate:self]; 337 | [UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)]; 338 | // 0.02 prevents the hud from passing through touches during the animation the hud will get completely hidden 339 | // in the done method 340 | if (animationType == MBProgressHUDAnimationZoomIn) { 341 | self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(1.5f, 1.5f)); 342 | } else if (animationType == MBProgressHUDAnimationZoomOut) { 343 | self.transform = CGAffineTransformConcat(rotationTransform, CGAffineTransformMakeScale(0.5f, 0.5f)); 344 | } 345 | 346 | self.alpha = 0.02f; 347 | [UIView commitAnimations]; 348 | } 349 | else { 350 | self.alpha = 0.0f; 351 | [self done]; 352 | } 353 | self.showStarted = nil; 354 | } 355 | 356 | - (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void*)context { 357 | [self done]; 358 | } 359 | 360 | - (void)done { 361 | [NSObject cancelPreviousPerformRequestsWithTarget:self]; 362 | isFinished = YES; 363 | self.alpha = 0.0f; 364 | if (removeFromSuperViewOnHide) { 365 | [self removeFromSuperview]; 366 | } 367 | #if NS_BLOCKS_AVAILABLE 368 | if (self.completionBlock) { 369 | self.completionBlock(); 370 | self.completionBlock = NULL; 371 | } 372 | #endif 373 | if ([delegate respondsToSelector:@selector(hudWasHidden:)]) { 374 | [delegate performSelector:@selector(hudWasHidden:) withObject:self]; 375 | } 376 | } 377 | 378 | #pragma mark - Threading 379 | 380 | - (void)showWhileExecuting:(SEL)method onTarget:(id)target withObject:(id)object animated:(BOOL)animated { 381 | methodForExecution = method; 382 | targetForExecution = MB_RETAIN(target); 383 | objectForExecution = MB_RETAIN(object); 384 | // Launch execution in new thread 385 | self.taskInProgress = YES; 386 | [NSThread detachNewThreadSelector:@selector(launchExecution) toTarget:self withObject:nil]; 387 | // Show HUD view 388 | [self show:animated]; 389 | } 390 | 391 | #if NS_BLOCKS_AVAILABLE 392 | 393 | - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block { 394 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 395 | [self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:NULL]; 396 | } 397 | 398 | - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block completionBlock:(void (^)())completion { 399 | dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); 400 | [self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:completion]; 401 | } 402 | 403 | - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue { 404 | [self showAnimated:animated whileExecutingBlock:block onQueue:queue completionBlock:NULL]; 405 | } 406 | 407 | - (void)showAnimated:(BOOL)animated whileExecutingBlock:(dispatch_block_t)block onQueue:(dispatch_queue_t)queue 408 | completionBlock:(MBProgressHUDCompletionBlock)completion { 409 | self.taskInProgress = YES; 410 | self.completionBlock = completion; 411 | dispatch_async(queue, ^(void) { 412 | block(); 413 | dispatch_async(dispatch_get_main_queue(), ^(void) { 414 | [self cleanUp]; 415 | }); 416 | }); 417 | [self show:animated]; 418 | } 419 | 420 | #endif 421 | 422 | - (void)launchExecution { 423 | @autoreleasepool { 424 | #pragma clang diagnostic push 425 | #pragma clang diagnostic ignored "-Warc-performSelector-leaks" 426 | // Start executing the requested task 427 | [targetForExecution performSelector:methodForExecution withObject:objectForExecution]; 428 | #pragma clang diagnostic pop 429 | // Task completed, update view in main thread (note: view operations should 430 | // be done only in the main thread) 431 | [self performSelectorOnMainThread:@selector(cleanUp) withObject:nil waitUntilDone:NO]; 432 | } 433 | } 434 | 435 | - (void)cleanUp { 436 | taskInProgress = NO; 437 | #if !__has_feature(objc_arc) 438 | [targetForExecution release]; 439 | [objectForExecution release]; 440 | #else 441 | targetForExecution = nil; 442 | objectForExecution = nil; 443 | #endif 444 | [self hide:useAnimation]; 445 | } 446 | 447 | #pragma mark - UI 448 | 449 | - (void)setupLabels { 450 | label = [[UILabel alloc] initWithFrame:self.bounds]; 451 | label.adjustsFontSizeToFitWidth = NO; 452 | label.textAlignment = MBLabelAlignmentCenter; 453 | label.opaque = NO; 454 | label.backgroundColor = [UIColor clearColor]; 455 | label.textColor = self.labelColor; 456 | label.font = self.labelFont; 457 | label.text = self.labelText; 458 | [self addSubview:label]; 459 | 460 | detailsLabel = [[UILabel alloc] initWithFrame:self.bounds]; 461 | detailsLabel.font = self.detailsLabelFont; 462 | detailsLabel.adjustsFontSizeToFitWidth = NO; 463 | detailsLabel.textAlignment = MBLabelAlignmentCenter; 464 | detailsLabel.opaque = NO; 465 | detailsLabel.backgroundColor = [UIColor clearColor]; 466 | detailsLabel.textColor = self.detailsLabelColor; 467 | detailsLabel.numberOfLines = 0; 468 | detailsLabel.font = self.detailsLabelFont; 469 | detailsLabel.text = self.detailsLabelText; 470 | [self addSubview:detailsLabel]; 471 | } 472 | 473 | - (void)updateIndicators { 474 | 475 | BOOL isActivityIndicator = [indicator isKindOfClass:[UIActivityIndicatorView class]]; 476 | BOOL isRoundIndicator = [indicator isKindOfClass:[MBRoundProgressView class]]; 477 | 478 | if (mode == MBProgressHUDModeIndeterminate) { 479 | if (!isActivityIndicator) { 480 | // Update to indeterminate indicator 481 | [indicator removeFromSuperview]; 482 | self.indicator = MB_AUTORELEASE([[UIActivityIndicatorView alloc] 483 | initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]); 484 | [(UIActivityIndicatorView *)indicator startAnimating]; 485 | [self addSubview:indicator]; 486 | } 487 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000 488 | [(UIActivityIndicatorView *)indicator setColor:self.activityIndicatorColor]; 489 | #endif 490 | } 491 | else if (mode == MBProgressHUDModeDeterminateHorizontalBar) { 492 | // Update to bar determinate indicator 493 | [indicator removeFromSuperview]; 494 | self.indicator = MB_AUTORELEASE([[MBBarProgressView alloc] init]); 495 | [self addSubview:indicator]; 496 | } 497 | else if (mode == MBProgressHUDModeDeterminate || mode == MBProgressHUDModeAnnularDeterminate) { 498 | if (!isRoundIndicator) { 499 | // Update to determinante indicator 500 | [indicator removeFromSuperview]; 501 | self.indicator = MB_AUTORELEASE([[MBRoundProgressView alloc] init]); 502 | [self addSubview:indicator]; 503 | } 504 | if (mode == MBProgressHUDModeAnnularDeterminate) { 505 | [(MBRoundProgressView *)indicator setAnnular:YES]; 506 | } 507 | } 508 | else if (mode == MBProgressHUDModeCustomView && customView != indicator) { 509 | // Update custom view indicator 510 | [indicator removeFromSuperview]; 511 | self.indicator = customView; 512 | [self addSubview:indicator]; 513 | } else if (mode == MBProgressHUDModeText) { 514 | [indicator removeFromSuperview]; 515 | self.indicator = nil; 516 | } 517 | } 518 | 519 | #pragma mark - Layout 520 | 521 | - (void)layoutSubviews { 522 | [super layoutSubviews]; 523 | 524 | // Entirely cover the parent view 525 | UIView *parent = self.superview; 526 | if (parent) { 527 | self.frame = parent.bounds; 528 | } 529 | CGRect bounds = self.bounds; 530 | 531 | // Determine the total widt and height needed 532 | CGFloat maxWidth = bounds.size.width - 4 * margin; 533 | CGSize totalSize = CGSizeZero; 534 | 535 | CGRect indicatorF = indicator.bounds; 536 | indicatorF.size.width = MIN(indicatorF.size.width, maxWidth); 537 | totalSize.width = MAX(totalSize.width, indicatorF.size.width); 538 | totalSize.height += indicatorF.size.height; 539 | 540 | CGSize labelSize = MB_TEXTSIZE(label.text, label.font); 541 | labelSize.width = MIN(labelSize.width, maxWidth); 542 | totalSize.width = MAX(totalSize.width, labelSize.width); 543 | totalSize.height += labelSize.height; 544 | if (labelSize.height > 0.f && indicatorF.size.height > 0.f) { 545 | totalSize.height += kPadding; 546 | } 547 | 548 | CGFloat remainingHeight = bounds.size.height - totalSize.height - kPadding - 4 * margin; 549 | CGSize maxSize = CGSizeMake(maxWidth, remainingHeight); 550 | CGSize detailsLabelSize = MB_MULTILINE_TEXTSIZE(detailsLabel.text, detailsLabel.font, maxSize, detailsLabel.lineBreakMode); 551 | totalSize.width = MAX(totalSize.width, detailsLabelSize.width); 552 | totalSize.height += detailsLabelSize.height; 553 | if (detailsLabelSize.height > 0.f && (indicatorF.size.height > 0.f || labelSize.height > 0.f)) { 554 | totalSize.height += kPadding; 555 | } 556 | 557 | totalSize.width += 2 * margin; 558 | totalSize.height += 2 * margin; 559 | 560 | // Position elements 561 | CGFloat yPos = round(((bounds.size.height - totalSize.height) / 2)) + margin + yOffset; 562 | CGFloat xPos = xOffset; 563 | indicatorF.origin.y = yPos; 564 | indicatorF.origin.x = round((bounds.size.width - indicatorF.size.width) / 2) + xPos; 565 | indicator.frame = indicatorF; 566 | yPos += indicatorF.size.height; 567 | 568 | if (labelSize.height > 0.f && indicatorF.size.height > 0.f) { 569 | yPos += kPadding; 570 | } 571 | CGRect labelF; 572 | labelF.origin.y = yPos; 573 | labelF.origin.x = round((bounds.size.width - labelSize.width) / 2) + xPos; 574 | labelF.size = labelSize; 575 | label.frame = labelF; 576 | yPos += labelF.size.height; 577 | 578 | if (detailsLabelSize.height > 0.f && (indicatorF.size.height > 0.f || labelSize.height > 0.f)) { 579 | yPos += kPadding; 580 | } 581 | CGRect detailsLabelF; 582 | detailsLabelF.origin.y = yPos; 583 | detailsLabelF.origin.x = round((bounds.size.width - detailsLabelSize.width) / 2) + xPos; 584 | detailsLabelF.size = detailsLabelSize; 585 | detailsLabel.frame = detailsLabelF; 586 | 587 | // Enforce minsize and quare rules 588 | if (square) { 589 | CGFloat max = MAX(totalSize.width, totalSize.height); 590 | if (max <= bounds.size.width - 2 * margin) { 591 | totalSize.width = max; 592 | } 593 | if (max <= bounds.size.height - 2 * margin) { 594 | totalSize.height = max; 595 | } 596 | } 597 | if (totalSize.width < minSize.width) { 598 | totalSize.width = minSize.width; 599 | } 600 | if (totalSize.height < minSize.height) { 601 | totalSize.height = minSize.height; 602 | } 603 | 604 | size = totalSize; 605 | } 606 | 607 | #pragma mark BG Drawing 608 | 609 | - (void)drawRect:(CGRect)rect { 610 | 611 | CGContextRef context = UIGraphicsGetCurrentContext(); 612 | UIGraphicsPushContext(context); 613 | 614 | if (self.dimBackground) { 615 | //Gradient colours 616 | size_t gradLocationsNum = 2; 617 | CGFloat gradLocations[2] = {0.0f, 1.0f}; 618 | CGFloat gradColors[8] = {0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.0f,0.75f}; 619 | CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); 620 | CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, gradColors, gradLocations, gradLocationsNum); 621 | CGColorSpaceRelease(colorSpace); 622 | //Gradient center 623 | CGPoint gradCenter= CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2); 624 | //Gradient radius 625 | float gradRadius = MIN(self.bounds.size.width , self.bounds.size.height) ; 626 | //Gradient draw 627 | CGContextDrawRadialGradient (context, gradient, gradCenter, 628 | 0, gradCenter, gradRadius, 629 | kCGGradientDrawsAfterEndLocation); 630 | CGGradientRelease(gradient); 631 | } 632 | 633 | // Set background rect color 634 | if (self.color) { 635 | CGContextSetFillColorWithColor(context, self.color.CGColor); 636 | } else { 637 | CGContextSetGrayFillColor(context, 0.0f, self.opacity); 638 | } 639 | 640 | 641 | // Center HUD 642 | CGRect allRect = self.bounds; 643 | // Draw rounded HUD backgroud rect 644 | CGRect boxRect = CGRectMake(round((allRect.size.width - size.width) / 2) + self.xOffset, 645 | round((allRect.size.height - size.height) / 2) + self.yOffset, size.width, size.height); 646 | float radius = self.cornerRadius; 647 | CGContextBeginPath(context); 648 | CGContextMoveToPoint(context, CGRectGetMinX(boxRect) + radius, CGRectGetMinY(boxRect)); 649 | CGContextAddArc(context, CGRectGetMaxX(boxRect) - radius, CGRectGetMinY(boxRect) + radius, radius, 3 * (float)M_PI / 2, 0, 0); 650 | CGContextAddArc(context, CGRectGetMaxX(boxRect) - radius, CGRectGetMaxY(boxRect) - radius, radius, 0, (float)M_PI / 2, 0); 651 | CGContextAddArc(context, CGRectGetMinX(boxRect) + radius, CGRectGetMaxY(boxRect) - radius, radius, (float)M_PI / 2, (float)M_PI, 0); 652 | CGContextAddArc(context, CGRectGetMinX(boxRect) + radius, CGRectGetMinY(boxRect) + radius, radius, (float)M_PI, 3 * (float)M_PI / 2, 0); 653 | CGContextClosePath(context); 654 | CGContextFillPath(context); 655 | 656 | UIGraphicsPopContext(); 657 | } 658 | 659 | #pragma mark - KVO 660 | 661 | - (void)registerForKVO { 662 | for (NSString *keyPath in [self observableKeypaths]) { 663 | [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:NULL]; 664 | } 665 | } 666 | 667 | - (void)unregisterFromKVO { 668 | for (NSString *keyPath in [self observableKeypaths]) { 669 | [self removeObserver:self forKeyPath:keyPath]; 670 | } 671 | } 672 | 673 | - (NSArray *)observableKeypaths { 674 | return [NSArray arrayWithObjects:@"mode", @"customView", @"labelText", @"labelFont", @"labelColor", 675 | @"detailsLabelText", @"detailsLabelFont", @"detailsLabelColor", @"progress", @"activityIndicatorColor", nil]; 676 | } 677 | 678 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 679 | if (![NSThread isMainThread]) { 680 | [self performSelectorOnMainThread:@selector(updateUIForKeypath:) withObject:keyPath waitUntilDone:NO]; 681 | } else { 682 | [self updateUIForKeypath:keyPath]; 683 | } 684 | } 685 | 686 | - (void)updateUIForKeypath:(NSString *)keyPath { 687 | if ([keyPath isEqualToString:@"mode"] || [keyPath isEqualToString:@"customView"] || 688 | [keyPath isEqualToString:@"activityIndicatorColor"]) { 689 | [self updateIndicators]; 690 | } else if ([keyPath isEqualToString:@"labelText"]) { 691 | label.text = self.labelText; 692 | } else if ([keyPath isEqualToString:@"labelFont"]) { 693 | label.font = self.labelFont; 694 | } else if ([keyPath isEqualToString:@"labelColor"]) { 695 | label.textColor = self.labelColor; 696 | } else if ([keyPath isEqualToString:@"detailsLabelText"]) { 697 | detailsLabel.text = self.detailsLabelText; 698 | } else if ([keyPath isEqualToString:@"detailsLabelFont"]) { 699 | detailsLabel.font = self.detailsLabelFont; 700 | } else if ([keyPath isEqualToString:@"detailsLabelColor"]) { 701 | detailsLabel.textColor = self.detailsLabelColor; 702 | } else if ([keyPath isEqualToString:@"progress"]) { 703 | if ([indicator respondsToSelector:@selector(setProgress:)]) { 704 | [(id)indicator setValue:@(progress) forKey:@"progress"]; 705 | } 706 | return; 707 | } 708 | [self setNeedsLayout]; 709 | [self setNeedsDisplay]; 710 | } 711 | 712 | #pragma mark - Notifications 713 | 714 | - (void)registerForNotifications { 715 | NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; 716 | 717 | [nc addObserver:self selector:@selector(statusBarOrientationDidChange:) 718 | name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; 719 | } 720 | 721 | - (void)unregisterFromNotifications { 722 | NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; 723 | [nc removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; 724 | } 725 | 726 | - (void)statusBarOrientationDidChange:(NSNotification *)notification { 727 | UIView *superview = self.superview; 728 | if (!superview) { 729 | return; 730 | } else { 731 | [self updateForCurrentOrientationAnimated:YES]; 732 | } 733 | } 734 | 735 | - (void)updateForCurrentOrientationAnimated:(BOOL)animated { 736 | // Stay in sync with the superview in any case 737 | if (self.superview) { 738 | self.bounds = self.superview.bounds; 739 | [self setNeedsDisplay]; 740 | } 741 | 742 | // Not needed on iOS 8+, compile out when the deployment target allows, 743 | // to avoid sharedApplication problems on extension targets 744 | #if __IPHONE_OS_VERSION_MIN_REQUIRED < 80000 745 | // Only needed pre iOS 7 when added to a window 746 | BOOL iOS8OrLater = kCFCoreFoundationVersionNumber >= kCFCoreFoundationVersionNumber_iOS_8_0; 747 | if (iOS8OrLater || ![self.superview isKindOfClass:[UIWindow class]]) return; 748 | 749 | UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; 750 | CGFloat radians = 0; 751 | if (UIInterfaceOrientationIsLandscape(orientation)) { 752 | if (orientation == UIInterfaceOrientationLandscapeLeft) { radians = -(CGFloat)M_PI_2; } 753 | else { radians = (CGFloat)M_PI_2; } 754 | // Window coordinates differ! 755 | self.bounds = CGRectMake(0, 0, self.bounds.size.height, self.bounds.size.width); 756 | } else { 757 | if (orientation == UIInterfaceOrientationPortraitUpsideDown) { radians = (CGFloat)M_PI; } 758 | else { radians = 0; } 759 | } 760 | rotationTransform = CGAffineTransformMakeRotation(radians); 761 | 762 | if (animated) { 763 | [UIView beginAnimations:nil context:nil]; 764 | [UIView setAnimationDuration:0.3]; 765 | } 766 | [self setTransform:rotationTransform]; 767 | if (animated) { 768 | [UIView commitAnimations]; 769 | } 770 | #endif 771 | } 772 | 773 | @end 774 | 775 | 776 | @implementation MBRoundProgressView 777 | 778 | #pragma mark - Lifecycle 779 | 780 | - (id)init { 781 | return [self initWithFrame:CGRectMake(0.f, 0.f, 37.f, 37.f)]; 782 | } 783 | 784 | - (id)initWithFrame:(CGRect)frame { 785 | self = [super initWithFrame:frame]; 786 | if (self) { 787 | self.backgroundColor = [UIColor clearColor]; 788 | self.opaque = NO; 789 | _progress = 0.f; 790 | _annular = NO; 791 | _progressTintColor = [[UIColor alloc] initWithWhite:1.f alpha:1.f]; 792 | _backgroundTintColor = [[UIColor alloc] initWithWhite:1.f alpha:.1f]; 793 | [self registerForKVO]; 794 | } 795 | return self; 796 | } 797 | 798 | - (void)dealloc { 799 | [self unregisterFromKVO]; 800 | #if !__has_feature(objc_arc) 801 | [_progressTintColor release]; 802 | [_backgroundTintColor release]; 803 | [super dealloc]; 804 | #endif 805 | } 806 | 807 | #pragma mark - Drawing 808 | 809 | - (void)drawRect:(CGRect)rect { 810 | 811 | CGRect allRect = self.bounds; 812 | CGRect circleRect = CGRectInset(allRect, 2.0f, 2.0f); 813 | CGContextRef context = UIGraphicsGetCurrentContext(); 814 | 815 | if (_annular) { 816 | // Draw background 817 | BOOL isPreiOS7 = kCFCoreFoundationVersionNumber < kCFCoreFoundationVersionNumber_iOS_7_0; 818 | CGFloat lineWidth = isPreiOS7 ? 5.f : 2.f; 819 | UIBezierPath *processBackgroundPath = [UIBezierPath bezierPath]; 820 | processBackgroundPath.lineWidth = lineWidth; 821 | processBackgroundPath.lineCapStyle = kCGLineCapButt; 822 | CGPoint center = CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2); 823 | CGFloat radius = (self.bounds.size.width - lineWidth)/2; 824 | CGFloat startAngle = - ((float)M_PI / 2); // 90 degrees 825 | CGFloat endAngle = (2 * (float)M_PI) + startAngle; 826 | [processBackgroundPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES]; 827 | [_backgroundTintColor set]; 828 | [processBackgroundPath stroke]; 829 | // Draw progress 830 | UIBezierPath *processPath = [UIBezierPath bezierPath]; 831 | processPath.lineCapStyle = isPreiOS7 ? kCGLineCapRound : kCGLineCapSquare; 832 | processPath.lineWidth = lineWidth; 833 | endAngle = (self.progress * 2 * (float)M_PI) + startAngle; 834 | [processPath addArcWithCenter:center radius:radius startAngle:startAngle endAngle:endAngle clockwise:YES]; 835 | [_progressTintColor set]; 836 | [processPath stroke]; 837 | } else { 838 | // Draw background 839 | [_progressTintColor setStroke]; 840 | [_backgroundTintColor setFill]; 841 | CGContextSetLineWidth(context, 2.0f); 842 | CGContextFillEllipseInRect(context, circleRect); 843 | CGContextStrokeEllipseInRect(context, circleRect); 844 | // Draw progress 845 | CGPoint center = CGPointMake(allRect.size.width / 2, allRect.size.height / 2); 846 | CGFloat radius = (allRect.size.width - 4) / 2; 847 | CGFloat startAngle = - ((float)M_PI / 2); // 90 degrees 848 | CGFloat endAngle = (self.progress * 2 * (float)M_PI) + startAngle; 849 | [_progressTintColor setFill]; 850 | CGContextMoveToPoint(context, center.x, center.y); 851 | CGContextAddArc(context, center.x, center.y, radius, startAngle, endAngle, 0); 852 | CGContextClosePath(context); 853 | CGContextFillPath(context); 854 | } 855 | } 856 | 857 | #pragma mark - KVO 858 | 859 | - (void)registerForKVO { 860 | for (NSString *keyPath in [self observableKeypaths]) { 861 | [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:NULL]; 862 | } 863 | } 864 | 865 | - (void)unregisterFromKVO { 866 | for (NSString *keyPath in [self observableKeypaths]) { 867 | [self removeObserver:self forKeyPath:keyPath]; 868 | } 869 | } 870 | 871 | - (NSArray *)observableKeypaths { 872 | return [NSArray arrayWithObjects:@"progressTintColor", @"backgroundTintColor", @"progress", @"annular", nil]; 873 | } 874 | 875 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 876 | [self setNeedsDisplay]; 877 | } 878 | 879 | @end 880 | 881 | 882 | @implementation MBBarProgressView 883 | 884 | #pragma mark - Lifecycle 885 | 886 | - (id)init { 887 | return [self initWithFrame:CGRectMake(.0f, .0f, 120.0f, 20.0f)]; 888 | } 889 | 890 | - (id)initWithFrame:(CGRect)frame { 891 | self = [super initWithFrame:frame]; 892 | if (self) { 893 | _progress = 0.f; 894 | _lineColor = [UIColor whiteColor]; 895 | _progressColor = [UIColor whiteColor]; 896 | _progressRemainingColor = [UIColor clearColor]; 897 | self.backgroundColor = [UIColor clearColor]; 898 | self.opaque = NO; 899 | [self registerForKVO]; 900 | } 901 | return self; 902 | } 903 | 904 | - (void)dealloc { 905 | [self unregisterFromKVO]; 906 | #if !__has_feature(objc_arc) 907 | [_lineColor release]; 908 | [_progressColor release]; 909 | [_progressRemainingColor release]; 910 | [super dealloc]; 911 | #endif 912 | } 913 | 914 | #pragma mark - Drawing 915 | 916 | - (void)drawRect:(CGRect)rect { 917 | CGContextRef context = UIGraphicsGetCurrentContext(); 918 | 919 | CGContextSetLineWidth(context, 2); 920 | CGContextSetStrokeColorWithColor(context,[_lineColor CGColor]); 921 | CGContextSetFillColorWithColor(context, [_progressRemainingColor CGColor]); 922 | 923 | // Draw background 924 | float radius = (rect.size.height / 2) - 2; 925 | CGContextMoveToPoint(context, 2, rect.size.height/2); 926 | CGContextAddArcToPoint(context, 2, 2, radius + 2, 2, radius); 927 | CGContextAddLineToPoint(context, rect.size.width - radius - 2, 2); 928 | CGContextAddArcToPoint(context, rect.size.width - 2, 2, rect.size.width - 2, rect.size.height / 2, radius); 929 | CGContextAddArcToPoint(context, rect.size.width - 2, rect.size.height - 2, rect.size.width - radius - 2, rect.size.height - 2, radius); 930 | CGContextAddLineToPoint(context, radius + 2, rect.size.height - 2); 931 | CGContextAddArcToPoint(context, 2, rect.size.height - 2, 2, rect.size.height/2, radius); 932 | CGContextFillPath(context); 933 | 934 | // Draw border 935 | CGContextMoveToPoint(context, 2, rect.size.height/2); 936 | CGContextAddArcToPoint(context, 2, 2, radius + 2, 2, radius); 937 | CGContextAddLineToPoint(context, rect.size.width - radius - 2, 2); 938 | CGContextAddArcToPoint(context, rect.size.width - 2, 2, rect.size.width - 2, rect.size.height / 2, radius); 939 | CGContextAddArcToPoint(context, rect.size.width - 2, rect.size.height - 2, rect.size.width - radius - 2, rect.size.height - 2, radius); 940 | CGContextAddLineToPoint(context, radius + 2, rect.size.height - 2); 941 | CGContextAddArcToPoint(context, 2, rect.size.height - 2, 2, rect.size.height/2, radius); 942 | CGContextStrokePath(context); 943 | 944 | CGContextSetFillColorWithColor(context, [_progressColor CGColor]); 945 | radius = radius - 2; 946 | float amount = self.progress * rect.size.width; 947 | 948 | // Progress in the middle area 949 | if (amount >= radius + 4 && amount <= (rect.size.width - radius - 4)) { 950 | CGContextMoveToPoint(context, 4, rect.size.height/2); 951 | CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius); 952 | CGContextAddLineToPoint(context, amount, 4); 953 | CGContextAddLineToPoint(context, amount, radius + 4); 954 | 955 | CGContextMoveToPoint(context, 4, rect.size.height/2); 956 | CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius); 957 | CGContextAddLineToPoint(context, amount, rect.size.height - 4); 958 | CGContextAddLineToPoint(context, amount, radius + 4); 959 | 960 | CGContextFillPath(context); 961 | } 962 | 963 | // Progress in the right arc 964 | else if (amount > radius + 4) { 965 | float x = amount - (rect.size.width - radius - 4); 966 | 967 | CGContextMoveToPoint(context, 4, rect.size.height/2); 968 | CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius); 969 | CGContextAddLineToPoint(context, rect.size.width - radius - 4, 4); 970 | float angle = -acos(x/radius); 971 | if (isnan(angle)) angle = 0; 972 | CGContextAddArc(context, rect.size.width - radius - 4, rect.size.height/2, radius, M_PI, angle, 0); 973 | CGContextAddLineToPoint(context, amount, rect.size.height/2); 974 | 975 | CGContextMoveToPoint(context, 4, rect.size.height/2); 976 | CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius); 977 | CGContextAddLineToPoint(context, rect.size.width - radius - 4, rect.size.height - 4); 978 | angle = acos(x/radius); 979 | if (isnan(angle)) angle = 0; 980 | CGContextAddArc(context, rect.size.width - radius - 4, rect.size.height/2, radius, -M_PI, angle, 1); 981 | CGContextAddLineToPoint(context, amount, rect.size.height/2); 982 | 983 | CGContextFillPath(context); 984 | } 985 | 986 | // Progress is in the left arc 987 | else if (amount < radius + 4 && amount > 0) { 988 | CGContextMoveToPoint(context, 4, rect.size.height/2); 989 | CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius); 990 | CGContextAddLineToPoint(context, radius + 4, rect.size.height/2); 991 | 992 | CGContextMoveToPoint(context, 4, rect.size.height/2); 993 | CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius); 994 | CGContextAddLineToPoint(context, radius + 4, rect.size.height/2); 995 | 996 | CGContextFillPath(context); 997 | } 998 | } 999 | 1000 | #pragma mark - KVO 1001 | 1002 | - (void)registerForKVO { 1003 | for (NSString *keyPath in [self observableKeypaths]) { 1004 | [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:NULL]; 1005 | } 1006 | } 1007 | 1008 | - (void)unregisterFromKVO { 1009 | for (NSString *keyPath in [self observableKeypaths]) { 1010 | [self removeObserver:self forKeyPath:keyPath]; 1011 | } 1012 | } 1013 | 1014 | - (NSArray *)observableKeypaths { 1015 | return [NSArray arrayWithObjects:@"lineColor", @"progressRemainingColor", @"progressColor", @"progress", nil]; 1016 | } 1017 | 1018 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 1019 | [self setNeedsDisplay]; 1020 | } 1021 | 1022 | @end 1023 | --------------------------------------------------------------------------------