Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jnoxx

macrumors 65816
Original poster
Dec 29, 2010
1,343
0
Aartselaar // Antwerp // Belgium
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.
 
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?
 
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.
 
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.