In my application i use the following code to navigate to a new view on receiving a click, It is working properly on iOS5. However, When i try with ios6 it is showing the current view and Is not goin to the next view. Do i need to change anything for ios6 in this code.
please help me to solve.
scoreview *sview=[[scoreview alloc] initWithNibName:#"scoreview" bundle:nil];
[self.navigationController pushViewController:sview animated:YES];
Try these lines:
scoreview *sview=[[scoreview alloc] initWithNibName:#"scoreview" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:sview animated:YES];
Can you please check your view is Correctly connected with UIInterfaceBuilder
Related
In my project i have used navigation controller to move to another but i have some view in which there is my custom navigation controller.
Please suggest me what should i do ?
I have tried doing like this but is occurring crash for me.
[self.navigationController presentModalViewController:myVechileView animated:YES];
[self presentModalViewController:myVechileView animated:YES];
[self.navigationController presentViewController:myVechileView animated:YES completion:nil];
presentModalViewController:animated: takes a UIViewController not a UIView
if you are useing iOS 6 then use this..
[self.navigationController presentViewController:myVechileView animated:YES completion:nil];'
and if you are ruing on iOS 5 then
[self.navigationController presentModalViewController:myVechileView animated:YES];
hope this help you
I have this same piece of code in two different parts of my app.
In one section it is executed perfectly, and in the other it is completely ignored. I've put in a breakpoint and watched the program go through each line of this code without loading the next xib/class it is supposed to.
Here is the code:
UIViewController *nextController = [[ClassNameViewController alloc] initWithNibName:#"MatchingView" bundle:nil];
[nextController performSelector:#selector(setDelegate:) withObject:self];
[self presentModalViewController:nextController animated:YES];
Any ideas why this might be getting ignored and not presenting my viewController?
Try using ..
[self.navigationController presentModalViewController:nextController animated:YES];
I had this code in viewDidLoad and moving it to viewDidAppear made it work.
My app is crashing when I dismiss a ModalViewController via:
[self.parentViewController dismissModalViewControllerAnimated:YES];
This modal view-controller ("MVC") is presented when a user clicks on one of the cells of a UINavigationController ("NavRoot") - here's the code for that:
MVC *modalView = [[MVC alloc] initWithNibName:#"MVC" bundle:nil];
[self.navigationController presentModalViewController: modalView animated:YES];
[modalView release];
The "modalView" which is loaded contains only 2 objects: a UIWebView object and a "DONE" button, which when clicked-on does the dissmissing via:
[self.parentViewController dismissModalViewControllerAnimated:YES];
Except when I click on "DONE" - the app crashes.
When I run Instruments with NSZombies I do see the retain count reaches -1 but I can't tell what's causing this over-release.
The only thing I found which solves the problem is to either add a "[modalView retain]" statement in "NavRoot" - which is the viewController doing the presenting of modalView:
MVC *modalView = [[MVC alloc] initWithNibName:#"MVC" bundle:nil];
[self.navigationController presentModalViewController: modalView animated:YES];
[modalView retain]; // <<== new 'retain' statement
[modalView release];
or just simply never releasing modalView in the first place:
MVC *modalView = [[MVC alloc] initWithNibName:#"MVC" bundle:nil];
[self.navigationController presentModalViewController: modalView animated:YES];
// commenting out the 'release':
// [modalView release];
Both of these options throw flags when I run "Analyze" ("Potential leak of an object allocated on line 34"...) but they do fix the problem.
Still, I worry about this causing the app to be rejected by Apple from the App Store.
Any ideas on what may be causing the over-release? Or how I might further try to isolate / identify the problem?
attaching an image of Instruments/Zombies report:
Are u using iOS 5? I had the same problem when I switched an app from ios4 to 5.
ParentViewController is now called presentingViewController
What you can do though is in your modal view just call [self dismissModalViewController] and it should dismiss itself. I'm not 100% about that and can't check as I'm not near my mac, but I recall reading it in the docs,
If you do
[self.navigationController presentModalViewController: modalView animated:YES];
Then you should dismiss it like
[self.navigationController dismissModalViewControllerAnimated:YES];
Rather than
[self.parentViewController dismissModalViewControllerAnimated:YES];
Where are you trying to dismiss the view from? The actual modalView or the parentView? It seems to me that you are trying to dismiss a modal view that has already been dismissed and subsequently released.
To dismiss a modalViewController I simply just do: [self dismissModalViewControllerAnimated:YES];.
[self dismissModalViewControllerAnimated:YES] does not work on iOS 5.
I have built a category that add presentingViewController on iOS 4. (It disables itself on iOS 5.)
Just include 2 files, and it works seamlessly.
Please see backward-modal.
I hope this benefits you as much as it does to me; It makes your code more clean!
I am new bee in iPhone and just started development in it.
Learning a lot because of friends like you!
I just learnt how to go to another screen from current screen and i Did well due to tutorials from Internet.
But now the problem is when new screen comes up it animates from Bottom to Up and when we click DONE button to close the screen it goes from Up to Down. I have seen many applications in iPhone that animate the new screen from Right to Left and again from Left to Right.
What Piece of code do i need to add into the following to animate it toward left.
Please guide me Friends
MainScreen *screen = [[MainScreen alloc] initWithNibName:#"MainScreen" bundle:[NSBundle mainBundle]];
self.mainScreen = screen;
[self presentModalViewController:mainScreen animated:YES];
There are four different ModelTransitionsFor View Controllers.
You can set those for
screen.modalTransitionStyle = UIModalTransitionStylePartialCurl;
There are 3 other Styles you can check on Apple Site Link
If you need to do something like Navigation Style. you need to push your view controller to navigation stack.
[self.navigationController pushViewController:screen animated:YES];
Instead of this
[self.navigationController presentModalViewController:yourView animated:YES];
use this
[self.navigationController pushViewController:yourView animated:YES];
If you have Navigation based app then replace code with below.
MainScreen *screen = [[MainScreen alloc] initWithNibName:#"MainScreen" bundle:[NSBundle mainBundle]];
self.mainScreen = screen;
[self.navigationController pushViewController:screen animated:YES];
There are few modal view transitional styles available. Check apples documentation on this.
Also there are few uiviewtransitionanimation styles also described neatly in apple's guide.
My app is crashing when I navigate two view controllers in my application. For example, if I do this sequence:
RootController
ViewControllerA
ViewControllerB
ViewControllerA
My app crashes.
It crashes when I pressed the back button in ViewControllerB. So, It seems like it is with two or more ViewControllers being pushed. Each by themselves work.
I don't know why.
This is the code I am using to invoke new views.
salesViewController *anotherViewController = [[salesViewController alloc] initWithNibName:#"salesView" bundle:nil];
//confirmViewController *anotherViewController = [[confirmViewController alloc] initWithNibName:#"confirmView" bundle:nil];
[self.navigationController pushViewController:anotherViewController animated:YES];
[anotherViewController release];
Thanks in advance.
Good news is that your code to create new views is just fine. Bad news is that it's somewhere else. I found this conversation on the net that seems to be a similar issue.