0

I would like to call FrameMarkersAppdelegate from another view base when I push the UIBotton. How can I do?

FrameMarkersAppdelegate.mm

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    window = [[UIWindow alloc] initWithFrame: screenBounds];
    [self setupSplashContinuation];
    [QCARutils getInstance].targetType = TYPE_FRAMEMARKERS;

    // Add the EAGLView and the overlay view to the window
    arParentViewController = [[ARParentViewController alloc] init];
    arParentViewController.arViewRect = screenBounds;
    [window insertSubview:arParentViewController.view atIndex:0];
    [window makeKeyAndVisible];
    return YES;
}

ViewController.m

-(IBAction)displaySelection:(id)sender 
{
       // How can I start FrameMarkersAppDelegate here?
}
danielbeard
  • 9,120
  • 3
  • 44
  • 58
kantawit
  • 101
  • 1
  • 1
  • 6

2 Answers2

0
FrameMarkersAppdelegate *appDelegate = [[UIApplication sharedApplication] delegate];
sunkehappy
  • 8,970
  • 5
  • 44
  • 65
  • And don't forget to `#import "FrameMarkersAppdelegate.h"` – Hesham Jan 21 '13 at 07:39
  • and how to use appDelegate to call Delegate – kantawit Jan 21 '13 at 07:45
  • What do you mean by call Delegate? I assume you want to call some method in file FrameMarkersAppdelegate.m, right? If that is the case, above answer (along with the things I suggest) can pretty much address your need. – Nirav Bhatt Jan 21 '13 at 07:48
0

While sunkehappy's answer pretty much addresses what you need, you can save some processing time by making appDelegate your class member.

That said, app Delegate is very important class to have many shared implementations of your app. To further save your execution time, here is something you may also want to try.

Community
  • 1
  • 1
Nirav Bhatt
  • 6,940
  • 5
  • 45
  • 89