I have following code in my application.
[self.navigationController pushViewController:x animated:YES];
It will push a new view to the application.
I want to change the animation time for pushing.
What should I Do?
You can't use the built-in UINavigationController Animation to accomplish this. It isn't customizable.
You will instead have to create your own animation, like with a CATransition. Then you can configure all of the attributes.
The only problem will be the navigation bar. You will have to handle that as well.
Also you will have to get the navigation hierarchy correct. You may have to be creative to get this right.
Related
I am trying to create multiple views in my view-based iPhone app in Xcode 4. I have followed many tutorials and read many articles but none of them have worked. I figured out that they require a Navigation Controller. How can I create 2 views that are switched with a button without a Navigation Controller?
Thanks!
I would use presentModalViewController. There are a ton of youtube videos on how to switch views, some of them don't have presentModalViewController so you have to watch the video to see if they write presentModalViewController in their code. I always use presentModalViewController.
you can create one additional view and keep it as a retained variable in your controller and on demand, you can do
[self.view addSubview:secondView];
//or - to remove second view and show first view
[secondView removeFromSuperView];
Why not use a UINavigationController but disable the navigation bar?
It's the easiest way to do it. And it will avoid many issues that can come about with incorrect view controller programming. Your users will never know the difference - there are no visual clues that you've done it that way.
I've started developing my first game. Here some my thoughts about architecture:
Most examples use the project template based on single view and manage of control visibility by hand. In my game I've 6-7 views and I'd like use Interface Builder for some of them. There are some problems too:
If I use a single based view I'll need, for example, in "Play" button's handler to create new view with a game board and destroy previous one (the view contains that button's handler). Is it right and how can I do it?
If I use a navigation based view I'll use push/pop methods but I'll need to hide a navigation bar for game atmosphere and to do navigation by hand. Moreover, I couldn't find any example of use a navigation controller in games. Does anybody use it and how?
What can you advice me?
1) you can hide navigation bar from nib file.
2) you can remove navigation animation by setting animation by [self pushViewController:nav animated:NO];
3)if you do not want to use navigation controller , you can use view based application and through coding you can add/remove subviews and views as per need.
How to get above thing in my application?
What is this? I don't know what we call this type of thing can any one guide me for this and the technical term of this?
Thanks in advance..
You can use one view controller to present another view controller modally on top of it.
[currentViewController presentModalViewController:viewControllerToPresentInModalWindow
animated:YES];
By default, the modal view controller will be full-screen, but you can change the size to one of two other presets.
[viewControllerToPresentInModalWindow setModalPresentationStyle:UIModalPresentationPageSheet];
[viewControllerToPresentInModalWindow setModalPresentationStyle:UIModalPresentationFormSheet];
Additionally, you can set the transition used to display the modal window on screen by using setModalTransitionStyle:.
The screenshot posted above is not using any of these presets; as the other commenters mentioned, it is a custom modal window that doesn't leverage UIKit's built-in modal functionality.
Basically, what I am trying to do is I have my TestViewController and there are 2 views under it, the first view will start with a tool bar and 2 buttons, one for imagepicker and the other one for mail sending, I am already done with that, and after pick the image from the photo library, the second view will be popped out(I want to do some image editing here) with a tool bar and 1 button back to the first view. I am doing something like [self.view addSubview:2ndview], and it works, but when I am trying to use -(IBAction)dismissDrawing:{[2ndview removeFromSuperview] }the program just shut down.
Can anyone help me? Really appreciate your help!
Look at my sample application I did last year. Basically you need a view that will act like a superview, then add views on top of it (if I remember correctly, it's been a while since I did it that way, now I just use multiple xibs).
It sounds like what you're trying to do would be better suited to a modal view.
See Human Interface Guidelines - Modal Views
Instead of adding a subview, try
[self presentModalViewController:secondView animated:YES];
Then in the dismissDrawing you can use
[self dismissModalViewControllerAnimated:YES];
I'm developing an iphone apllication that stores some data into a database. That is working fine. But now i have a problem when i want to show the data. Because to show the data i need to design another view. But i'm facing problem when i try to add another view.Is it possible to have multiple view in a view-based application,cause my application is a view-based application? If yes then how to do that? Please help me
Thanks in advance
Joy
yes. In principle you create your new view [alloc/ init], then display it.
Normally you would display it by pushing it onto the navigation controller stack.
[self.navigationController pushViewController:newViewController animated:YES];
If you don't have a navigation controller, you either need to create one (your best bet might be to use xcode to make a navigation based application and take a look at how its put together).
If you just want to simply display a second view controller, then you can display that as a modal view controller: alloc/init your second view controller then display it with
[self presetModalViewController:newViewContoller animated:YES];
Finally you could do a front view/ flipside view. Take a look at the utility application template in xcode.
Yes it is possible to use multiple views. You can manually add them to the window by using addSubView.
You can also use a view controller like a UINavigationController or a UITabBarController.
It depends on how you want to display the views and how the user can switch between them.