I would like to create an utility application that has a navigation based flipside, or "info", view. What would the most efficient way to accomplish this be? I think that i 'simply' need to make a root view controller for the flipside view...but i really only understand that conceptually...not so much how to go about it or, at least, i am not confident that i know how to go about it.
I apologize for the slightly "make my app" nature of this question i have books and books and books...but it shakes out so much differently when i want to make my own project.
You can use a view controller for the flipside view, or you could create / load a view in your app delegate. In the latter case, you can set up the delegate to respond to the info button press, and then set up a transition to the new view which will have a button (which the app delegate also responds to) that transitions back to the previous view.
There is a basic tutorial I found for this here:
http://www.iphonedevsdk.com/forum/iphone-sdk-development/12222-how-do-i-create-uiview-flip-animation.html#post104474
It should be able to at least get you started.
Related
Today I tried to perform a custom segue for UINavigationController push/pop operations and I didn't find a solution.
I can obviously perform the push operation with a custom segue with no problem, but the pop operation (using the default back button) seems to be complicated (Some notes here https://developer.apple.com/library/ios/technotes/tn2298/_index.html).
On the other side with iOS 7 performing custom transitions is quite simple and I can achieve a custom push/pop operations thanks to new APIs.
I which case you choose to create custom transitions and when you just work with custom segue?
My question is probably quite generic and it depends on what we need to do... But I'd like to have your opinion.
You can't perform a pop navigation with segues, A segues is only forward or one Directional, it can go reverse from its tack trace, you would have to manually pop your controllers using a back button, also I would go for Segues if I have a simple navigational app like the one's where you go from one controller to next , but choose Custom Transitions, when the navigation depends upon the data values or you need to perform a different action at a different input
On the MVC paradigm, a view can only communicate with a controller, and via a blind communication (target-action or delegate/dataSource). I understand that, but is it a violation of MVC if a view communicates with another view, using a delegate?
Almost always. The delegate of the view should never be another view. It should be a controller. The controller is the appropriate place to drive changes in the other view.
A view should almost never say something that another view would care about. A view should say to its delegate things like "I was touched." Why would another view care? It's up to the controller to say "ah, a touch here means that I should move the active focus. I should tell the current active view to let go of focus" (as an example). I view is not responsible for determining what events mean in the broader application, only what events happened, and so are very unlikely to generate messages of interest to other views.
My opinion on this is to use the observer design pattern and simply use notifications (NSNotification)
I am a novice myself. But I would think that it's not. A jsp page when called could just redirect you to anothr jsp page. I have seen that happen sometime. So I guess it is in a way, a view calling another view.
I am a newbie in all this as will be apparent really soon.
I am using the iOS: Application: Tabbed application template. I have placed a UIImageView in the first view and two standard rounded buttons. One button is attached to an action in the FirstView Controller which places a picture into the UIImageView. The second button is attached to an action in the AppDelegate which calls a method in the FirstViewController which in turn places a second picture into the UIImageView.
The AppDelegate method does not replace the picture. It doesn't crash… it just does not seem to do anything.
How can I manipulate the view in the First and Second View Controller from the AppDelegate?
#dasdom
Well that's one issue explained. I've been reading the theory of MVC and trying to put it into practice now. Short version is I am trying to write a Battleship app for practice. Was planning on using the first screen to setup the game pieces, prefs, etc.. and use the second screen for actual game play.
I've created another class to use as my "brain center" but I ran into the same issue of not being able to manipulate anything on the screen for the first or second views. (That's why I tried the appDelegate).
That's my life story right now… can you throw some pointers my way on how to proceed and how to solve my one of many problems?
First you shouldn't do that. The AppDelegate should only be responsible for bringing the first view onto the screen.
Second you should have a look into the Model-View-Controller design pattern. Search for it in your preferred search machine.
But I you really still want to do that you should have a look into delegation and/or notifications. For example you could send the First View Controller a notification from the AppDelegate to change the image.
Relevant Data:
I'm making a simple game, using OpenglES. The game itself is done, however I would like to have a main menu as well as some other screens designed in IB. So far I have a death/score screen that is displayed with a simple modelviewcontroller.
I haven't done a ton with GUI building or much programming on the platform outside of C code (posix sockets) and some examples from some books. So I'm not sure how I would go about having lots of views- usually I just use a model view, and it's gotten me along just fine so far. However I don't think that would be the best route here.
Situation:
I have a view controller that shows my main menu- the main menu branches off to the main game, a settings screen, and a high score screen. The main game is made in opengl, and I haven't made the settings view yet, but it likely will be as well. How should I switch between the views? Presenting the main view from the app delegate is as simple as setting the root view controller = newly created view controller, should I do the same thing here? If I do that can I remove the resources from the menu view controller?
Sorry if this is an extremely simple question, I just don't quite get the process.
I'm not entirely sure what you want to do, but an easy way to show a new view controller is:
SecondViewController *aSecondViewController = [[SecondViewController alloc]
initWithNibName:#"SecondView" bundle:nil];
[self presentModalViewController:aSecondViewController animated:YES];
I hope that helps.
How should I switch between the views?
In the vast majority of cases, you should be using a UINavigationController. Your initial controller would be the main menu. When you want to go into a particular section of your application, you push a new view controller onto the stack. When you want to come back out, you pop it off the stack.
Besides navigation and presenting modally that others have mentioned, another option is to swap out views. May or may not fit your app's flow but wanted to point out another option for you to consider
Best practice for switching iPhone views?
If you are already limiting the game to iOS 5 for some other reason you should look into UIStoryboard. If you don't currently require iOS5 the "simplest" way is to use table views, but that isn't a very "gamey" UI.
I'm trying to create an iPhone app with a welcome screen that leads to two or three pretty disparate UIs; once you've drilled into one you're not going to have much use for the others, and each one is itself fairly complicated.
The designers are all web types and it looks like the "navigation" paradigm is the closest to what they want, but the breadcrumb-style navigation bar isn't.
If I set up a UINavigationController, can I then drive it with arbitrary buttons in the views?
And in general, is it possible to swap out the contents of a view programmatically?
And if so, what do I need to watch out for? (E.g., in Java if you change the contents of a JPanel you need to make sure it gets revalidated and repainted.)
Total iOS newbie here, coming from the Java world, super-explicit advice much appreciated. Using Monotouch, but happy to take Obj-C help and translate. :)
It's hard to tell you how to design your app with only that information, so I'll assume you want to do a drill-down thing like a UINavigation controller.
1- Yes, you can drive the UINavigationController from other ViewControllers, using methods like PushViewController() and PopViewController(). You can also hide the toolbar or some of the toolbar buttons if you want. You can find some great examples here.
2- Yes, you can change contents of a view. Views contains other views and you can add and remove them as you want.
3- The main thing to be careful about is to make sure that calls that update the view are done inside a InvokeOnMainThread(()=>{}) call. More info here.