Search Results

Search found 44 results on 2 pages for 'uiapplicationdelegate'.

Page 1/2 | 1 2  | Next Page >

  • View Controller's viewDidLoad method finishing before applicationDidFinishLaunching

    - by mwt
    I'm creating a fairly complex iPhone app using Core Data. Up until now, things have been working fine. As the app has been getting more complex, however, a new problem has come up: the first view controller is finishing its viewDidLoad method before the AppDelegate gets even halfway through its applicationDidFinishLaunching method. The view controller is not the root, which is a tab bar controller. The VC in question is the one for the default selected tab on the tab bar. It's getting instantiated by IB. Nothing like this has occurred before in my experience, and it's throwing off the important initialization I'm doing in the AppDelegate (getting objects from Core Data and preparing them for use) . Furthermore, it's intermittent -- sometimes the delegate does finish first. Has anyone else noticed a difficulty like this? Any sample code that deals with such an issue? I suppose that the answer is to make the VC load the data that the AppDelegate is getting ready only when the AppDelegate sends a message that it's ready. I'm a bit concerned that this is adding something that will just end up biting me in the butt later on.

    Read the article

  • Hiding iPhone Status Bar pulls my tableViews up by 20px

    - by JustinXXVII
    When doing an asynchronous HTTP request, I hide the iPhone status bar and animate in my own custom UIViewController to show upload status. So instead of seeing signal strength, carrier, time and battery life, the user gets messages based on the progress of the HTTP request. My status bar is exactly 20px high, and fits nicely where the status bar used to be. When the HTTP activity is done, the custom view animates out and the iPhone status bar animates back in. I would like to just avoid hiding the iPhone status bar completely, and instead bring my custom view ON TOP of the status bar. Currently, if I invoke my custom view animation and keep the iPhone status bar set to visible, my custom view is behind it. This is the code I have: -(void) animateStatusBarIn { CGRect statusFrame = CGRectMake(0.0f, -20.0f, 320.0f, 20.0f); UploadStatusBar *statusView = [[UploadStatusBar alloc] initWithNibName:@"UploadStatusBar" bundle:nil]; self.status = statusView; [statusView release]; status.view.frame = statusFrame; [[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES]; [window addSubview:status.view]; [UIView beginAnimations:@"slideDown" context:nil]; [UIView setAnimationDuration:0.3]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(animationFinished:)]; status.view.frame = CGRectMake(0.0f, 0.0f, 320.0f, 20.0f); [UIView commitAnimations]; } -(void) animateStatusBarOut { [UIView beginAnimations:@"slideUp" context:nil]; [UIView setAnimationDuration:0.3]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(animationFinished:)]; status.view.frame = CGRectMake(0.0f, -20.0f, 320.0f, 20.0f); [UIView commitAnimations]; } -(void)animationFinished:(NSString *)name { if ([name isEqualToString:@"slideDown"]) { } if ([name isEqualToString:@"slideUp"]) { [[UIApplication sharedApplication]setStatusBarHidden:NO animated:YES]; [status.view removeFromSuperview]; } } Without the [[UIApplication sharedApplication]setStatusBarHidden:YES animated:YES] you can't see my custom view. How can I get my custom view to just appear on top of the status bar so I don't have to hide it? Thank you!

    Read the article

  • referencing an instantiated object in another class in objective C

    - by Paul
    hi, I am working in xcode on an ipod app in objective C, and I have a field (navigationController) in one of my classes (rootViewController). How do I reference the instantiated rootViewController's navigationController from another class? For example, how would I do this if I want to reference the navigationController from the FirstViewController.m class? I seem to only be able to find references for this to reference the application delegate. If I want to reference the application delegate with FirstViewController, I just say: MyAppDelegate *delegate = [[UIApplication sharedApplication] delegate]; [delegate.navigationController pushViewController:childController animated:YES]; how do I do this for the rootViewController class instead of MyAppDelegate?

    Read the article

  • Saving data - does work on Simulator, not on Device

    - by Peter Hajas
    I use NSData to persist an image in my application. I save the image like so (in my App Delegate): - (void)applicationWillTerminate:(UIApplication *)application { NSLog(@"Saving data"); NSData *data = UIImagePNGRepresentation([[viewController.myViewController myImage]image]); //Write the file out! NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path_to_file = [documentsDirectory stringByAppendingString:@"lastimage.png"]; [data writeToFile:path_to_file atomically:YES]; NSLog(@"Data saved."); } and then I load it back like so (in my view controller, under viewDidLoad): NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path_to_file = [documentsDirectory stringByAppendingString:@"lastimage.png"]; if([[NSFileManager defaultManager] fileExistsAtPath:path_to_file]) { NSLog(@"Found saved file, loading in image"); NSData *data = [NSData dataWithContentsOfFile:path_to_file]; UIImage *temp = [[UIImage alloc] initWithData:data]; myViewController.myImage.image = temp; NSLog(@"Finished loading in image"); } This code works every time on the simulator, but on the device, it can never seem to load back in the image. I'm pretty sure that it saves out, but I have no view of the filesystem. Am I doing something weird? Does the simulator have a different way to access its directories than the device? Thanks!

    Read the article

  • iPhone: Remove annotation from MKMapView which is in another view

    - by Nic Hubbard
    I have two views. The first is a MKMapView with some annotations. Clicking a UIButton pushes a second view on the stack. This has a UITableView with a list of annotations which correspond to the map annotations. So, when you click the delete button, how can I call my MKMapView which is in another view, so that I can remove the annotation. My MKMapView is declared in my app delegate, as well as my current class. I am trying to use the following, but it is not working: RideAppDelegate *appDelegate = (RideAppDelegate *)[[UIApplication sharedApplication] delegate]; Annotation *ano; CLLocationCoordinate2D anoPoint; anoPoint.latitude = [[eventToDelete valueForKey:@"latitude"] doubleValue]; anoPoint.longitude = [[eventToDelete valueForKey:@"longitude"] doubleValue]; ano = [[[Annotation alloc] init] autorelease]; ano.coordinate = anoPoint; [appDelegate.ridesMap removeAnnotation: ano]; [appDelegate release]; I must be trying to access the MKMapView of my other view incorrectly?

    Read the article

  • How much should the AppDelegate do?

    - by Rudiger
    I'm designing quite a large App and on startup it will create sessions with a few different servers. As they are creating a session which is used across all parts of the app its something I thought would be best in App Delegate. But the problem is I need the session progress to be represented on the screen. I plan to have a UIToolBar at the bottom of the main menu which I don't want to cover with the progress bar but cover the UIView above it.So the way I see it I could do it a few different ways. 1) Have the App Delegate establish the sessions and report the progress to the main menu class so it can represent it in the progress bar (will I have any issues doing this if the sessions are created in a separate thread?), 2) have the App delegate display the main menu (UIView with a bunch of buttons and UIToolBar) and have it track and display the progress (I have never displayed anything in the App Delegate but assume you can do this but its not recommended) or 3) have the App Delegate just push the main menu and have the mainMenu class create the sessions and display the progress bar. 4) I think the other way to do it is to create the sessions in a delegate class and have the delegate set to mainMenu rather than self (AppDelegate), although I've never used anything other then self so not sure if this will work or if I will be able to close the thread (through calling super maybe?) as its running in the AppDelegate rather than the delegate of the class. As I've kinda said before the sessions are being created in a class in a separate thread so it wont lock the UI and I think the best way is the first but am I going to have issues having it running in a separate thread, reporting back to the app delegate and then sending that message to the mainMenu view? I hope that all makes sense, let me know if you need any further clarification. Any information is appreciated Cheers,

    Read the article

  • iOS Application Background Downloading

    - by Hankweb
    Hey! I need to know how I can have my iOS Application start a download in the background of the application (like, have the download run in the AppDelegate file) so changing ViewControllers will not interrupt or cancel the download. I also need to be able to get the progress of the download (0.00000 - 1.00000), to set a UIProgressView object to, which also means I need a - (void)progressDidChangeTo:(int)progress function.

    Read the article

  • iOS Facebook SDK: FBRequestDelegate only works on AppDelegate??

    - by RMR
    Hi guys, I want to encapsulate all my Facebook interactions within a FacebookFacade class to keep things clean and tidy. I have an instance of the iOS SDK Facebook class within my FacebookFacade. My problem is that when I make a Graph API call within the facade, such as: [self.facebook requestWithGraphPath:@"me" andDelegate:self]; the only method of FBRequestDelegate that gets called is requestLoading: and nothing else. I have tried putting similar code in other places, like in controllers and other models, and there too not all of the FBRequestDelegate methods get called, only requestLoading:. In fact the only way I can get the other FBRequestDelegate methods to be called is to put all my Facebook logic in the AppDelegate and make my AppDelegate the FBRequestDelegate. Why is this the case? Am I missing something here? I definitely do not want to use the AppDelegate as my FBRequestDelegate as I don't want to confuse the purpose of the AppDelegate. Thanks.

    Read the article

  • How to call another class's method from my app delegate

    - by Jared
    I have an application that utilizes UILocalNotifications to pop-up UIAlertViews. When the notification fires, the user chooses to go into the app, and this method is called from my app delegate: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {...} Where I can handle it and where I also prompt another alertview for more information. So when the app launches, it is displaying view A, and then the alertview pops up and prompts for input. This alertview, however, is originating from my app delegate. I need to be able to reload view A when the user hits Yes/No on the alertview. How can I do that from within my app delegate? Any help is appreciated!!

    Read the article

  • iPhone: Run method from another view

    - by Nic Hubbard
    I have two views that I am loading, the first is a view with an MKMapView, the second has a table view. I would like to access a method in the first views controller, from the second view. I have been told to use the delegate for this, but I can't get it right. In my app delegate, I have set up added properties for the class of my first view. Then, in my second view, I try to access the first view using the delegate: MyAppDelegate *mainDelegate = (MyAppDelegate*) [[UIApplication sharedApplication] delegate]; Then try: [mainDelegate.mapViewControllerClass myMethodToRun]; It seems to me that it should be calling the myMethodToRun method, which is in my map view. But, it does not work. What is wrong with what I am doing here? There must be a way to access a method of another view...

    Read the article

  • iOS UITableViewCell UIImageView setting on different conditions

    - by chis54
    I have an app that has a UITableView and in my Cells I have UIImageViews and UILabels that change images/textColors for a day theme and a night theme (trying to be automatically set). My issue is that I set the images and colors when the table is populated with cellForRowAtIndexPath and its during the day "theme", then if I reopen the app hours later in the night "theme" and the app is still in the "background" and not needing to be reloaded (ie viewDidLoad doesn't fire), the day "theme" shows until I scroll the UITableView and then the night "theme" shows when new cells are brought into view by scrolling. How should I set the objects in my cells when changing around time of the day? I was thinking to use an NSTimer, but I'm not sure how to update the objects in my cells. I was also thinking about using the appropriate methods in the AppDelagate to set things in motion, but is there a way to force reloading the TableView? Any suggestions?

    Read the article

  • How to conform to UITabBarControllerDelegate

    - by 4thSpace
    I have a tabbar based application and do the following to get a reference to the application delegate: MyAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; Which then gives this warning: warning: type 'id <UIApplicationDelegate>' does not conform to the 'UITabBarControllerDelegate' My application delegate header looks like this: #import <UIKit/UIKit.h> @interface MyAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> { UIWindow *window; UITabBarController *tabBarController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; @end The only methods in the .m file are applicationDidFinishLaunching and dealloc. What else do I need to conform to the protocol?

    Read the article

  • Declaring CustomViewController?

    - by fuzzygoat
    I have noticed in some of my older apps that in situations where I have added a custom View Controller I have not changed the View Controller class in the application delegate. For example, below I have created a CustomViewController class but have declared viewController as UIViewController. @interface ApplicationAppDelegate: NSObject <UIApplicationDelegate> { UIWindow *window; UIViewController *viewController; } My question is, both work, but for correctness should I be writing this as follows: @class CustomViewController; @interface ApplicationAppDelegate: NSObject <UIApplicationDelegate> { UIWindow *window; CustomViewController *viewController; } gary

    Read the article

  • xcode IOS5 Creating one app from several apps

    - by Yaniza Familia
    This is my situation. I have about five different apps and they all perform well. I will like to make one app with all these little apps. How can I go about this with a master view application? Also these were created with nib file (xib) no storyboard. Can I create my files with storyboard or do I have to continue creating files with xib? Also, what to do with app delegate (UIApplicationDelegate) methods that are implemented in all applications? Please explain no knowledge on this part.

    Read the article

  • My UITabBarController's didSelectViewController method is not getting called?

    - by mobibob
    Here is my code stub for my app-delegate.m -- it never gets called. - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { NSLog(@"%s", __FUNCTION__); } It is defined in this app-delegate.h @interface OrioleAppDelegate : NSObject <UIApplicationDelegate, UITabBarControllerDelegate> { UIWindow *window; UITabBarController *tabBarController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet UITabBarController *tabBarController; @end

    Read the article

  • New to iPhone SDK: touchesBegan not called

    - by coriolan
    Hi, I created a very very basic iPhone app with File/New Projet/View-Based application. No NIB file there. Here is my appDelegate .h @interface MyAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; MyViewController *viewController; } .m - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after app launch [window addSubview:viewController.view]; [window makeKeyAndVisible]; } And here is my loadView method in my controller - (void)loadView { CGRect mainFrame = [[UIScreen mainScreen] applicationFrame]; UIView *contentView = [[UIView alloc] initWithFrame:mainFrame]; contentView.backgroundColor = [UIColor redColor]; self.view = contentView; [contentView release]; } Now, in order to catch the touchesBegan event, I created a new subclass of UIView: .h @interface TouchView : UIView { } .m - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"Touch detected"); } and modified the second line in my loadView into this : TouchView *contentView = [[UIView alloc] initWithFrame:mainFrame]; Why is touchesBegan never called?

    Read the article

  • Why is UIApplicationWillChangeStatusBarFrameNotification not sent when the in-call status bar is sho

    - by Sbrocket
    I've been trying to listen for changes in the status bar height – such as when the in-call status bar is shown or hidden – by listening for the UIApplicationWillChangeStatusBarFrameNotification notification to be sent. Fairly straightforward code here... [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarWillChangeFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil]; But the notification never seems to be sent in that case, either on the Simulator by using the "Toggle In-Call Status Bar" option or on the device when a call ends with the application open. In addition, the similar UIApplicationDelegate method is not called. According to the documentation, UIApplicationWillChangeStatusBarFrameNotification Posted when the application is about to change the frame of the status bar. The userInfo dictionary contains an NSValue object that encapsulates a CGRect structure expressing the location and size of the new status bar frame. Use UIApplicationStatusBarFrameUserInfoKey to access this value. Can anyone explain why this notification is not being sent in response to the in-call status bar being shown or hidden? According to the documentation, it should be.

    Read the article

  • Why am I getting this warning about my app delegate and CLLocationManageDelegate?

    - by Dan Ray
    Observe this perfectly simple UIViewController subclass method: -(IBAction)launchSearch { OffersSearchController *search = [[OffersSearchController alloc] initWithNibName:@"OffersSearchView" bundle:nil]; EverWondrAppDelegate *del = [UIApplication sharedApplication].delegate; [del.navigationController pushViewController:search animated:YES]; [search release]; } On the line where I get *del, I am getting a compiler warning that reads, Type 'id <UIApplicationDelegate>' does not conform to the 'CLLocationManagerDelegate' protocol. In fact, my app delegate DOES conform to that protocol, AND what I'm doing here has nothing at all to do with that. So what's up with that message? Secondary question: sometimes I can get to my navigationController via self.navigationController, and sometimes I can't, and have to go to my app delegate's property to get it like I'm doing here. Any hint about why that is would be very useful.

    Read the article

  • Showing/Hiding windows iPhone Dev

    - by Cal S
    In my iPhone app I am developing, I have defined two windows: @interface The_NoteAppDelegate : NSObject <UIApplicationDelegate> { IBOutlet UIWindow *newNoteWindow; IBOutlet UIWindow *homeWindow; } @property (nonatomic, retain) UIWindow *newNoteWindow; @property (nonatomic, retain) UIWindow *homeWindow; and they are linked correctly in IB - but how do I show/hide these windows? [homeWindow makeKeyAndVisible]; works in appDidFinishLaunching but when I try [newNoteWindow makeKeyAndVisible]; again to open the other window (on a button touch event) in front of the other, the app freezes. I know this is a very n00by question but please help me out :)

    Read the article

  • Switching between TabBarController Views when event fired

    - by aahrens
    I have a UITabBarController with two different views to switch between. What I would like to do is when a button is clicked in View1 to switch directly to View2. Then in View2 if they click a button it switches them to View1. It transfers between View1 and View2 when the click on the tabBarController fine but I'm trying to perform the switching for them when an event occurs Is there a way to do this by calling a method on my UITabBarController? @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UITabBarController *tabBarController; }

    Read the article

  • Setting an NSMutableArray in AppDelegate to be an NSMutableArray in

    - by aahrens
    What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate. I then have two UIViewControllers. One view is responsible for displaying the array from the AppDelegate. The other view is used to add items to the array. So the array starts out to be empty. View1 doesn't display anything because the array is empty. The User goes to View2 and adds an item to the array in AppDelegate. Then when the user goes back to View1 it now displays one item. Here is how I'm trying to accomplish this @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITabBarController *tabBarController; NSMutableArray *globalClasses; } @property (nonatomic,retain) NSMutableArray *globalClasses; My other view In the viewDidload I set the array in my View to be the one in the AppDelegate. In an effort to retain values. allCourses = [[NSMutableArray alloc]init]; CalcAppDelegate *appDelegate = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; allCourses = appDelegate.globalClasses; Then I would update my allCourses array by adding a new item. Then try to set the array in the AppDelegate to be equal to the modified one. CalcAppDelegate *appDel = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; NSLog(@"Size before reset %d",[appDel.globalClasses count]); appDel.globalClasses = allCourses; NSLog(@"Size after reset %d",[appDel.globalClasses count]); What I'm seeing that's returned is 2 in the before, and 2 after. So it doesn't appear to be getting updated properly. Any suggestions?

    Read the article

  • iPhone: Using a NSMutableArry in the AppDelegate as a Global Variable

    - by aahrens
    What i'm trying to accomplish is to have an NSMutableArray defined in the AppDelegate. I then have two UIViewControllers. One view is responsible for displaying the array from the AppDelegate. The other view is used to add items to the array. So the array starts out to be empty. View1 doesn't display anything because the array is empty. The User goes to View2 and adds an item to the array in AppDelegate. Then when the user goes back to View1 it now displays one item. Here is how I'm trying to accomplish this @interface CalcAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; UITabBarController *tabBarController; NSMutableArray *globalClasses; } @property (nonatomic,retain) NSMutableArray *globalClasses; My other view In the viewDidload I set the array in my View to be the one in the AppDelegate. In an effort to retain values. allCourses = [[NSMutableArray alloc]init]; CalcAppDelegate *appDelegate = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; allCourses = appDelegate.globalClasses; Then I would update my allCourses array by adding a new item. Then try to set the array in the AppDelegate to be equal to the modified one. CalcAppDelegate *appDel = (CalcAppDelegate *)[[UIApplication sharedApplication] delegate]; NSLog(@"Size before reset %d",[appDel.globalClasses count]); appDel.globalClasses = allCourses; NSLog(@"Size after reset %d",[appDel.globalClasses count]); What I'm seeing that's returned is 2 in the before, and 2 after. So it doesn't appear to be getting updated properly. Any suggestions?

    Read the article

1 2  | Next Page >