My app uses a landscape only view and requires the user to answer a series of questions using a UISlider to select their answer before clicking "Next" to move to the next question.
The user can't go back to previous questions so only has one "direction" of travel. Once the final question is answered the app will return them to the Main Menu view.
I've had some trouble with the slide transition sliding the next view in but it thinks it is in portrait mode. I have seen a solution somewhere that NavController fixes this but is that necessary for my app?
The user doesn't really navigate as they can only go to the next screen, never to the previous.
If anyone has any other opinions on how to implement this it'd be much appreciated.
Thanks!
Oliver
I'm not sure if I know exactly what you want... but from what I understand I would simply use a navigation controller to handle all of the transitions. You can hide the back button so the user can't go back and all of the view animation comes with it! When the user selects an answer, just push the next question on the navigation controller's stack. Once you get to the end of the list, just pop off all the view controllers to get back to the start (main menu).
Is this kind of what you wanted? If you need help with some code snippets I can add some.
I think you will have to transform the transition so that it slides in on the right axis. By default it will slide right-left in portrait. The transition animation doesn't actually know the orientation of the device or the view.
Related
I have seen quite a few apps on the app store which display adverts at the top or bottom. I have managed to get adverts to work that is not the problem.
What i was wondering is how do you keep the same advert visible when you load a new view?
I am currently using the present and dismiss modal view functions to navigate through my app.
Thank you,
Mark.
Retain the advertView in a singleton class/AppDelgete (Means Keep this advert view as global and show it on each viewdidLoad) .
You can add the view as a subview of the window. You might have to bring the view to the front. However this approach will need to observe orientation changes and rotate the view appropriately. While this is possible, such a view might make the animations feel odd.
I am building a Calendar app. I have Navigation based app template. Navigation controller has segmented control having namely Daily and Weekly segments.
Upon clicking the segments i show the relevant View having status bar, navigation controller and bottom toolbar. This is working fine.
My daily view will have a top view and scrollView. Top view will have previous button, next button and date in label. When i add only scrollView inside my dailyView than it works fine, but upon adding top View it gives crash when i try to scroll the scrollView.
Please suggest is it possible? Else, what could be a better alternative? I even tried adding a second navigation bar (this time using the Interface Builder), button than i am not able to change the date in label.
Please let me know if more clarity is required.
I see you have two questions:
Please suggest is it possible? Else, what could be a better alternative?
So I'll go ahead and answer those questions:
What you're trying to do is possible, so there's no need to look for an alternative.
However, I guess the real question is: "Why is it crashing?" and I certainly would answer that, but without crash logs and(/or) code it's nearly impossible to give you a usable answer.
I am trying to develop an application for iphone 3G which requires flip from one page to another page.I can navigate from one page to another page by using navigation control but it gives the animation from "right" to "left" when page changes. Can i flip it in just opposite direction means the page will animate from "left" to "right" when requires to go back to previous page? the animation effect must be there.the application is navigation based not view based.And the back flip action must be in a button not in navigation bar button.
I think it can be done as we can do it by navigation bar button,but got to put that logic in normal button. pretty confused about the logic...
Can you please help me?
I just wrote an answer to another similar question which may be of help:
Push Next Detail UIView without going back to parent UITableView
You can use -[UINavigationController popViewControllerAnimated:] to reproduce the effect of the built-in "Back" button. Or there's -[UINavigationController popToViewController:animated:] if you want to go further back than one view controller.
For going from one view to another you can use [UINavigationController popViewControllerAnimated:YES] and when you u want to go to previous view you can do is write teh following line on button click event [UINavigationController popToViewController:animated:YES] and hide your back button in the navigation bar item as per your requirement.
My application is pretty simple: it starts up with a view controller that holds a table view (in grouped view layout) with a few options. When the user taps on one of the options, I push another view controller onto my navigation controller.
This second view controller simply displays a UIImageView, and the user can change the screen orientation on this view controller between portrait/landscape modes. This works just fine, and all is happy.
However, if the user taps on the "Back" button on my navigation bar while on the landscape mode, the first controller's layout is all messed up. See below for before/after screenshots:
(source: pessoal.org)
(source: pessoal.org)
Any clues on how to force the first view controller (second screenshot in this post) to stay within the portrait screen orientation?
There does not appear to be a way to do this using the documented methods.
I have filed a bug for this: rdar://6399924
"There is no way to always restrict a UIViewController to one orientation"
You can see it on open radar (along with a link to sample code to reproduce the problem) here: http://openradar.appspot.com/radar?id=697
Like someone on the open radar suggested, a workaround is to disable "back" button while in non-portrait:
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{
// don't let user press "back" button in landscape - otherwise previous view and the rest of the application
// will also be in landscape which we did not feel like testing yet
self.navigationController.navigationBarHidden = (UIInterfaceOrientationPortrait != self.interfaceOrientation);
}
There is a solution to do that : it's to use a view controller and adding its view to the window. then in that controller you force landscape in the shouldAutorotate... methode. It works fine, but be sure it's necessary for your project to use that, because it's not very smart to force the user to turn his iPhone. By the way, here is an example code if you need it.
http://www.geckogeek.fr/iphone-forcer-le-mode-landscape-ou-portrait-en-cours-dexecution.html
I wasn't able to get this to work the way I wanted. You ought to be able to set a particular orientation for a ViewController, but the NavigationController doesn't seem to always do the right thing.
I ennded up re-designing my screens so that they all work in either orientation. That might be extra work, but it "feels" more natural, anyway.
In this (Flip View Iphone) post, I have created a flip view for my iPhone app.
Now, I want to make sure that whenever the user hits the 'Back' button in the navigation bar, the next time around when he drills down to the flippable view, this view is in its original, non-flipped position. Currently, the app actually loads the correct view, but somehow, when you try to flip it over, it cannot doesn't load the flip view, and presents a black background only.
One solution could be to assign the flip back method ("showLessInfo") to the navigation button, and that is what I need your help for.
Alternatively, and quite likely a better idea for me would be to understand, why the flip view is not loaded the second time around.
Any suggestion is welcome!
You can override the viewWillAppear: method on your flip view's view controller and make sure behind the scenes it loads the proper view before showing (remember to call [super viewWillAppear:animated]).
Or else, you could override the viewWillDisappear and make sure things are cleaned up on the way out. It will get invoked when the user taps the back button.