Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 4, 2010, 01:55 AM   #1
printf
macrumors regular
 
Join Date: Aug 2008
how to correctly switch between views

i have a uiview and a uiwebview. at the moment they have no relationship with one another because i'm stuck at figuring out the 'correct' way to set them up. it really makes no difference to me, but i'd like to know which way is best.

on one hand, i could make the uiwebview a subview of my uiview. that would work for my purposes. however, it just seems weird that i'd be setting this up within my custom uiview class - i mean, isn't this the job of a viewcontroller?

on the other hand, i could treat both views as equals and let the view controller switch them out perhaps? but my custom uiview responds to events (such as touchesEnded) and only it knows when it's time is up and it's to be replaced by the uiwebview. the viewcontroller has no knowledge of this and therefore cannot know when to switch between the two.

any insight on the best approach here? thanks!
printf is offline   0 Reply With Quote
Old Jul 4, 2010, 04:37 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Use a navigation controller and push/pop between the view. You can hide the navigation bar if you want.
robbieduncan is offline   0 Reply With Quote
Old Jul 5, 2010, 05:43 PM   #3
printf
Thread Starter
macrumors regular
 
Join Date: Aug 2008
ah, i overlooked the navigation controller because i didn't know the nav bar could be removed.

still curious though, is there a way for one view to inform the nav controller that it's ready to be switched out with the other view? like from a touchesEnded event that's captured in that view?

btw, i'm not using IB.
printf is offline   0 Reply With Quote
Old Jul 5, 2010, 05:48 PM   #4
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
I'm not clear by what you mean by "switched out". Any view in a navigation controller can either push another view controller into the navigation stack or pop itself off the navigation stack.
robbieduncan is offline   0 Reply With Quote
Old Jul 5, 2010, 08:35 PM   #5
printf
Thread Starter
macrumors regular
 
Join Date: Aug 2008
right, and that's the part i'm confused with. every ui nav controller example i've seen on the web uses buttons hooked into ibactions in the app delegate to push/pop views.

my requirement is a little different. i have a 'splash screen' view that displays fade-in animation and should pop the splash view and push the main application view onto the nav stack when the animation is complete OR a user 'touches' the view anywhere. i'm still an mvc novice, so i'm not sure how to get the splash screen view to tell the navigation controller to push the main view. does that make sense?
printf is offline   0 Reply With Quote
Old Jul 5, 2010, 10:48 PM   #6
dejo
Moderator
 
dejo's Avatar
 
Join Date: Sep 2004
Location: The Centennial State
I would recommend instead, based on your needs, just presenting the splash screen modally and then dismissing it upon touch.
__________________

Last edited by dejo; Jul 6, 2010 at 11:43 AM. Reason: fixed typo.
dejo is online now   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Finder help (views) jamgam OS X Mavericks (10.9) 2 Dec 19, 2013 10:59 AM
Finder Views mikegml OS X 1 Nov 22, 2013 12:19 PM
How to switch between existing views? cthesky iPhone/iPad Programming 3 Oct 15, 2012 09:51 AM
AT&T's Mobile Share Plan: To switch or not to switch? HXGuy iPhone 13 Sep 22, 2012 10:29 PM
Switch views themacster298 Mac Programming 5 Jul 23, 2012 12:06 PM

Forum Jump

All times are GMT -5. The time now is 09:36 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC