appdelegate

How to present a splash/login view controller using storyboards

白昼怎懂夜的黑 提交于 2019-11-26 13:04:41
问题 I\'ve seen this question in various forms without a clear answer. I\'m going to ask and answer here. My app needs to do work on startup... inits, a few network calls, login, etc. I don\'t want my main view controller working until that\'s done. What\'s a good pattern for doing this? Requirements: iOS5+, storyboards, ARC. the main vc\'s view cannot appear until the startup work is done. want a choice of transition styles to the main vc when the startup work is done. want to do as much layout

Get device token for push notification

那年仲夏 提交于 2019-11-26 12:16:22
问题 I am working on push notifications. I wrote the following code for fetching a device token. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. // Add the view controller\'s view to the window and display. [self.window addSubview:viewController.view]; [self.window makeKeyAndVisible]; NSLog(@\"Registering for push notifications...\"); [[UIApplication sharedApplication]

Get the current view controller from the app delegate

元气小坏坏 提交于 2019-11-26 12:00:49
问题 i am new to ios. I need to know the current view controller from app delegate.. i have no idea about this and i don\'t knowto implement this. i am using this code toimplemnt this but it return null values. I followed this link- Get current view controller from the app delegate (modal is possible) need help. 回答1: This is what I use for finding the current view controller that the user is most likely interacting with: UIViewController+Utils.h #import <UIKit/UIKit.h> @interface UIViewController

What describes the Application Delegate best? How does it fit into the whole concept?

寵の児 提交于 2019-11-26 10:53:45
问题 I think to know what the App Delegate does. It has some nice methods like -applicationDidFinishLaunching which will be called when the app has finished launching, and so on. But what\'s that actually? Is that some object instantiated in the UIApplicationMain function? And how does it work that every class in my app has access to that App Delegate object? Is there any good graph on the net that visualizes these relationships? 回答1: In Cocoa, a delegate is an object that another object defers to

iOS - Calling App Delegate method from ViewController

限于喜欢 提交于 2019-11-26 09:05:02
问题 What I am trying to do is click a button (that was created in code) and have it call up a different view controller then have it run a function in the new view controller. I know it could be done relatively easily in IB but that isn\'t an option. An example of what I want to do would be if you had two view controllers one with a splash screen of house. The other view controller had a walk through of the house on it that you could go through all the rooms in a set order. The splash screen

AppDelegate, rootViewController and presentViewController

限于喜欢 提交于 2019-11-26 07:29:18
问题 I\'m doing the Facebook integration tutorial, I want to show my MainViewViewController if the user has a valid token for the current state otherwise I want to show LoginViewController. MainViewAppDelegate.m - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if (FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded) { // To-do, show logged in view } else { // No, display the login page. [self showLoginView]; } return YES;

NSInternalInconsistencyException&#39;, reason: &#39;Could not load NIB in bundle: &#39;NSBundle

随声附和 提交于 2019-11-26 06:06:00
问题 In my AppDelegate there is a problem I do not understand. RootViewController initially called ViewController and I changed it name. The application is formed by many ViewController then I have introduced a UINavigationController. Why this error comes? NSInternalInconsistencyException\', reason: \'Could not load NIB in bundle: \'NSBundle /Users/XXXXXXXXXXXX/Library/Application Support/iPhone simulator/6.0/Applications/ B7A7D461-1CFE-4B05-AF32-00B65FCFFF49/XXXXXXXXXX.app> (loaded)\'with name \

Opening view controller from app delegate using swift

こ雲淡風輕ζ 提交于 2019-11-26 05:22:14
问题 I am trying to create a push notification which determines which view to open according to information obtained from the push. I have managed to get the information from the push, but I am now struggling to get the view to open Looking at other stack overflow questions I have the following currently: App Delegate Did finish loading: //Extract the notification data if let notificationPayload = launchOptions?[UIApplicationLaunchOptionsRemoteNotificationKey] as? NSDictionary { // Get which page