Logic thinking

Discussion in 'iPhone/iPad Programming' started by jnoxx, May 26, 2011.

  1. macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #1
    Hai Guys, I have been coding so many hours to finish 4 apps this week. And now I am really tired, and can't figure out a normal solution to my problem..

    Let's say I have RootViewController, and on a button click, I push a special library (which is a UIViewController.) onto the navigation stack. In there, I have a hard coded button on my nav bar, which has to be able to jump to the second slideshow. (let me know if i'm not explaining right.)

    So like this.
    Code:
    
    - (IBAction) loadPage1 {
        // Browser
     
    	NSMutableArray *photos = [[NSMutableArray alloc] init];
        [photos addObject:[MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"Chapter1-1" ofType:@"png"]]];
    	// Create browser
    	MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithPhotos:photos];
    	//[browser setInitialPageIndex:0]; // Can be changed if desired
    	[self.navigationController pushViewController:browser animated:YES];
    	[browser release];
    	[photos release];
    }
    And on second page I need to think of a block of code, which will allow me to switch to let's say IBAction, loadPage2 or something similair.
    I was thinking of creating a pointer of the RootViewController, assign the self.parentViewController, but cast it as a (RootViewController*) but that gives back a UIViewController, and not the specific RootView.

    Can't wait to hear back. ciao.
     
  2. macrumors 68000

    Sydde

    Joined:
    Aug 17, 2009
    #2
    Is there a method or property of UINavigationContoller that will give you the nav stack in the form of an array with the root view controller at index 0?
     
  3. thread starter macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #3
    I'm gonna make a singleton, so it's accessable all over my app.
    That is only solution so far atm ^__^
     
  4. macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    I'm a little unclear what you're asking. It's common to use NSNotifications to send messages in a way that doesn't couple two classes together. Maybe you need for one of your child view controllers to send a notification that it's finished and its parent or another controller can then do whatever needs to happen next.
     
  5. thread starter macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #5
    Hai Phoney, that is exactly what I builded after this post. but still, it's not remembering in what kind of "chapter" it is from let's say a book. and based upon that number, it will load another chapter, when u press the notification. that's why im building a singleton for remembering that i think.
     

Share This Page