大佬教程收集整理的这篇文章主要介绍了objective-c – Xcode Interface Builder未显示App Delegate对象,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
注意:我研究并发现:Having trouble hooking up instance variables to AppDelegate但这个解决方案对我不起作用(或者我没有正确实现)
头文件
#import <UIKit/UIKit.h> #import <CoreLOCATIOn/CoreLOCATIOn.h> #import <MapKit/MapKit.h> @interface MOCAppDelegate : UIResponder <UIApplicationDelegate,CLLOCATIOnManagerDelegate> { CLLOCATIOnManager *LOCATIOnManager; IBOutlet MKMapView *worldView; IBOutlet UIActivityInDicatorView *activityInDicator; IBOutlet UITextField *LOCATIOntitleField; } @property (strong,nonatomiC) IBOutlet UIWindow *window; @end
实施档案
#import "MOCAppDelegate.h" @implementation MOCAppDelegate @synthesize window = _window; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //Create LOCATIOn manager object LOCATIOnManager = [[CLLOCATIOnManager alloc] init]; [LOCATIOnManager setDelegate:self]; //We want all results from the LOCATIOn manager [LOCATIOnManager setDistanceFilter:kCLDistanceFilterNone]; //And we want it to be as accurate as possible //regardless of how much time/power it takes [LOCATIOnManager setDesiredAccuracy:kCLLOCATIOnAccuracyBest]; //Tell our LOCATIOn manager to start looking for it LOCATIOn immediately [LOCATIOnManager startupdatingLOCATIOn]; //We also want to kNow our heading if (LOCATIOnManager.headingAvailable == truE) { [LOCATIOnManager startupdatingheading]; } self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.BACkgroundColor = [UIColor darkGrayColor]; [self.window makeKeyAndVisible]; return YES; } - (void)LOCATIOnManager:(CLLOCATIOnManager *)manager didupdateToLOCATIOn:(CLLOCATIOn *)newLOCATIOn fromLOCATIOn:(CLLOCATIOn *)oldLOCATIOn { NSLog(@"%@",newLOCATIOn); } - (void)LOCATIOnManager:(CLLOCATIOnManager *)manager didupdateheading:(CLheading *)newheading { NSLog(@"%@",newheading); } - (void)LOCATIOnManager:(CLLOCATIOnManager *)manager didFailWithError:(NSError *)error { NSLog(@"Could not find LOCATIOn: %@",error); } - (void)dealloc { if( [LOCATIOnManager delegate] == self) [LOCATIOnManager setDelegate:nil]; } - (void)applicationWillResignActive:(UIApplication *)application { /* 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. 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. */ } - (void)applicationDidEnterBACkground:(UIApplication *)application { /* 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 @R_696_8913@ terminated later. If your application supports BACkground execution,this method is called instead of applicationWillTerminate: when the user quits. */ } - (void)applicationWillEnterForeground:(UIApplication *)application { /* 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. */ } - (void)applicationDidBecomeActive:(UIApplication *)application { /* 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. */ } - (void)applicationWillTerminate:(UIApplication *)application { /* Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBACkground:. */ } @end
以上是大佬教程为你收集整理的objective-c – Xcode Interface Builder未显示App Delegate对象全部内容,希望文章能够帮你解决objective-c – Xcode Interface Builder未显示App Delegate对象所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。