uiapplicationdelegate

Possible to change AppDelegate at runtime

喜你入骨 提交于 2019-12-06 07:30:05
Is it possible to change the UIApplication.delegate property at runtime to another class that implements the UIApplicationDelegate protocol so that from then on UIApplicationDelegate functions are called on the new class? You can very simply change it with [UIApplication sharedApplication].delegate = instanceOfDifferentClass . 来源: https://stackoverflow.com/questions/28464515/possible-to-change-appdelegate-at-runtime

iPhone application crash on launch

荒凉一梦 提交于 2019-12-06 03:34:16
问题 We are receiving a crash log from iTunes connect that is a little strange. We were preivously having problems with our app taking to long to return from ApplicationDidFinishLaunching. This was caused by doing a too much work inside of applicationDidFinishLaunching and we exceeded the 20 second time out on slower devices. To fix this we moved all of our setup code out of ApplicationDidFinishLaunching and moved it into a special secondaryLoadingController. On top of that we moved the setup code

iOS app applicationWillEnterForeground and it stuck for a while

时光总嘲笑我的痴心妄想 提交于 2019-12-05 18:52:11
问题 I add this function to post a notification when the app enter foreground: - (void)applicationWillEnterForeground:(UIApplication *)application { [[NSNotificationCenter defaultCenter] postNotificationName: @"UIApplicationWillEnterForegroundNotification" object: nil]; } In my own class: - (void) handleEnterForeground: (NSNotification*) sender { [self reloadTableData]; } - (void)viewDidLoad { [super viewDidLoad]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector

Times of calling application:didFinishLaunchingWithOptions: differs between iOS 5.x and iOS 6

做~自己de王妃 提交于 2019-12-05 18:29:45
Subj. In iOS 5.x I have the next consequence of methods calling: -[UIViewController initWithCoder:] -[UIApplicationDelegate didFinishLaunchingWithOptions:] -[UIViewController viewDidLoad] -[UIViewController viewWillAppear:] -[UIViewController viewDidAppear:] But in iOS 6.x it's the next: -[UIViewController initWithCoder:] -[UIViewController viewDidLoad] -[UIViewController viewWillAppear:] -[UIApplicationDelegate didFinishLaunchingWithOptions:] -[UIViewController viewDidAppear:] So... what I gonna do? It's my fault or Apple have changed some logic? in your main.m return UIApplicationMain(argc,

clickedButtonAtIndex in appdelegate is not called

让人想犯罪 __ 提交于 2019-12-05 16:58:12
I am calling UIAlert with 2 buttons "Cancel" and "OK" in MyapplicationAppDelegate.m file , the alert is called but on tap of "Cancel" or "OK" button -(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex method is not called. I have added UIAlertViewDelegate in the MyapplicationAppDelegate.h file as below #import UIKit/UIKit.h @interface MyapplicationAppDelegate: NSObject UIApplicationDelegate,UIAlertViewDelegate { .. } I want to know what else is required. I am not sure whether its your typo while posting the question but you should call the delegate within <..

Unable to reset brightness on application exit iOS

ε祈祈猫儿з 提交于 2019-12-05 03:15:50
问题 Why can't I set screen brightness in applicationDidEnterBackground or applicationWillResignActive? This is my code: -(void)applicationDidEnterBackground:(UIApplication *)application { [[UIScreen mainScreen] setBrightness:1.0]; } Can't understand it...!? It works in applicationDidEnterForeground etc, just not when i close the app using the home button. Is there any other solution to this problem? 回答1: Update August 2016: Brightness changes made by an app remain in effect until the device is

How to get navController from AppDelegate.

三世轮回 提交于 2019-12-04 22:14:32
问题 I am wondering, that how to get navController from AppDelegate = [[UIApplication sharedApplication] delegate] in the iPhone programming. e.g., in other viewController where we reference to the AppDelegate. In the applicationDelegate.h we have: UINavigationController *navController; And the following in applicationDelegate.m - (void)applicationDidFinishLaunching:(UIApplication *)application { [window addSubview: navController.view]; [window makeKeyAndVisible]; } Is there anyway to get the

where to store main table view data? (appDelegate or rootViewController)

核能气质少年 提交于 2019-12-04 22:01:00
Any advice on where to store the main list data for an iPhone application like the following? NavigationController based Level 1 (main screen) is a List of Items. Hence it uses a table view (table of items) Level 2_EDIT: Is a view you can get to from the main screen by clicking EDIT. Here you can add text to be added to the main view list Level 2_DETAIL: Is a view you can get to from the main screen by clicking on a cell. Now assuming the implementation is (rough overview): * MainView - appDelegate (holds UIWindow & UINavigationController ) * RootViewController - table view of the main items

Where is your Application Delegate set and who initializes its window and viewController properties?

你离开我真会死。 提交于 2019-12-04 16:33:08
问题 I have a very newbie question about IOS apps... If I create a new View Based Application called TestForStackOverflow, Xcode automatically creates code like this for the TestForStackOverflowAppDelegate.h: @class TestForStackOverflowViewController; @interface TestForStackOverflowAppDelegate : NSObject <UIApplicationDelegate> @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet TestForStackOverflowViewController *viewController; @end and the following

present more than one modalview in appdelegate

让人想犯罪 __ 提交于 2019-12-04 12:21:05
问题 I want to present a modalviewcontroller after every push-message the app recieves in "application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo" I present the viewcontroller like this: ReleaseViewController *viewController = [[ReleaseViewController alloc] init]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; [self.window.rootViewController presentModalViewController:navController animated