iPad: Cannot display Second Modal View Controller after dismiss the first one - ios

Hi I am new to iOS development, and my app i am working on is allow users to log in to the server by using web services, and after the user logged in, he will get a list of the books he's allowed to access and then he select one and do what he needs to do after that.
So here is my problem. There is a "Sign In" button on the main view. After he click the button "Sign In", a modal view poped up asking him to fill in his username/password. I set up the main view controller to be the delegate so that the modal view controller can pass the credentials to the main view controller. After the log in information passed, the main view controller will dismiss the sign in view controller and connect to a server to verify user account. As the response, the server send back a list of book objects. Here I want to use a modal view to populate a UITableView with the book list to let user select from. So in the - (void)parserDidEndDocument:(NSXMLParser *)parser method in main view controller, I put the code to generate and show the second modal view with the book list, and it doesn't show no matter what I do. I know I did get the book list and I know the code to populate the second modal view got executed, but the second modal view just not show.
I read some related questions here and no matter how I dismiss the first modal view, the second one was not shown at all.

Actually I found a solution to it even though it is not a pretty solution at all. All I have to do is just set the dismissModalViewControllerAnimated to NO for the first modal view I dismissed and then I can have my second modal view shown up. I saw somebody used timer but that didn't work for me at all.

Related

Walkthrough with tab view controller

I have been attempting to create a walkthrough for my app although I also have a tab view controller which is the initial view controller. I have been able to identify when a user is opening the app for the first time, but when I make the walkthrough view controller initial, I get a Sigbart error. This is because I set up my tabbar in the app delegate.
Is there a way to possibly keep the tab bar VC the initial and hide the first VC if it is the users first time opening the app?
Is there another way of doing it?
I dont know the code to check of its the flrst time a user opens an app, but why dont you make that check on your tab bar controller? And then lf lt ls the first time, you just change the root vc to the tutorial vc. When they are done with the tutorial you just change back the root vc to the tab bar.
There easiest way to accomplish the tutorial-like behavior for new users is:
1) Make a new View Controller be the initial one.
2) Add code to check if its the first time the user launched the app. If it is, show the tutorial, if its not, show your tab view controller.
3) You can fill this "fake initial" view controller with the same image shown in the splash screen. This way the user will feel its just the splash one.
*) An added benefit of this approach is that you can check other useful things. For example, if your app has some kind of login feature you can manage it here skipping the login window for users who have already logged in. It can also be used to update your app's resources in case you are retrieving them from a server.

Modally presented view causes previous view to disappear when navigating away/to with tab bar view controller

I'm working on UITabBarController based app. The app has a concept of "user authentication/restriction" where particular tabs may become restricted/unrestricted at any point in time (via an admin).
When restricted, a "authentication" view is presented over the tab's current view. This is done simply via storyboard segue ways and is presented with "Kind" of "Present Modally" and "Presentation" of "Over current content"
Everything works just fine so long as the user doesn't navigate to a different tab while the "authentication" view is presented and back again after authorisation has been granted, in this case, the presenting view is blank
In its present form, I'm using the authentication view's viewDidLoad to check if the user is restricted or not, if they aren't, I'm triggering a return segue to the parent view, this means if the tab was restricted, but becomes unrestricted, the authentication view can be dismissed automatically
So, the sequence of events
User navigates to a "possibly restricted" tab/view
Restriction state requires authentication, the authentication view is presented
The user navigates to a different tab and back again and enters the authentication (or restrictions are lifted) and the authentication view is dismissed
Parent view is blank
I'm at a lose at how to resolve this.
I've tried (in the unwind segue method of the parent view)
view.setNeedsLayout() and view.setNeedsDisplay() in the parent view in response to the segue event from the authentication view
I've tried navigationController?.popToViewController(self, animated: false)
I've tried popping and pushing the view again
I've tried table.reloadData() (yes, the parent view is just a UITableViewController)
I've tried removing and re-adding the view, but probably did it wrong
I'm at a wits end in trying to get the view controller to perform a full refresh/reload
Update
I've been able to devise "a" solution, basically when viewWillDisappear is called on the authentication view, I perform a special "unauthorised dismissal" segue, the intention of which is to tell the parent view that the authentication view has been dismissed, but no authentication took place, letting it know that it should not try and update itself, but also not try and re-authenticate.
This allows the parent's viewDidAppear method to handle the authentication process again once it's made visible.
It works for me, but I'm open for more ideas

Segue type to be used for a user registration process - iOS 5

This is my first ios app & I have a user registration process which is separated out into 3 screens. The first screen has user to enter his mobile number, the second screen asks him select his location & the third screen asks him to enter his birthday and a few other details.
So in total, there are totally 3 controllers which I have used.
1) mobile_number_controller.rb
2) location_controller.rb
3) miscellaneous_details_controller.rb
Each detail the user enters is validated and is stored into the NSUserDefaults. If the validation fails then the user is not allowed to move to the next screen. Also, once the user enters his details correctly, then the user does not have a back button to go back to the previous screen as well.
I would like to know which is the type of segue to be used here. Should I embed these controllers in a navigation controller and use a push segue, or should I be using a modal segue?
Update regarding the chain of controllers.
I don't intend to take the user back to any presenting controller at any stage. Also, in most code I have read till now, for modal segues, I have seen the presented controller being dismissed or there's an unwind segue to go back to the presented controller. I am a bit confused on what to do with these presented controller here before presenting the next controller in the series?
Also, as I mentioned that I store whatever data has been entered by the user in NSUserDefaults, theres no need for the presenting controller to know about the data entered in the presented controller. Hence I don't feel the need for an unwind segue( like in the 'new contacts' application).
Any help on this would be much appreciated.
I would prefer a modal segue to present a navigation controller and push segues to connect the other view controllers. Similar to webapps a user perhaps want to step back to change previously entered information.
I would use a series of modal segues (presented view controller). This is not a "user can go forward and back among views" situation: you are in total control of what the user sees. It is perfectly legal to present a view controller on top of a presented view controller. Moreover, it is simple to control how far back you take the user, e.g. go back all the way (dismissing all the views), if that's what you want to do.

Dismissing a presented view controller: how to show a view controller different from the former

I'm asking this in the context of the common scenario of having a modal "Log In" view, and then showing the main view of the app when the log in is successful and the view is dismissed (as it can be seen in Twitter, Evernote, and so on..), instead of showing again the "welcome" view that presented the login view. I don't find any example of how can I achieve this.
Thanks!
EDIT: What I want to achieve is clearly shown in Instagram app. If you're not logged in, you are shown a welcome view with the logo and a table with "Register" and "Sign In" cells. From there, you can navigate to the corresponding register/sign in view. If you sign in, the "Sign In" view is dismissed with animation and the app's main view is shown below.
I tried to make my main view the rootViewController of my app and then to present an UINavigationController with the welcome view if the user is not logged in, but this way the main view is always shown first. Surprisingly, I don't find any example of handling this scenario and I think this is a very common one (having a welcome view if login needed and app's main view being only shown if login is successful or it was already done). I'd really appreciate some help and/or any example code.
Thanks again
EDIT2: I moved this particular question to Managing view controllers in an app where sign up required

adding a view to UISplitViewController in Storyboard, Xcode

in my application i have a UISplitView, but before this gets loaded I need to display a page where the user enters some details and then clicks okay to display the spitView. I have tried dragging a view controller from the object library on the right but this gives problems. Please advise me on the right way to approach what I'm trying to do,
Thank you
I would have the splitview present the viewController that collects the user data. Present it modally then dismiss it after they enter the data and the split view will be there for you.

Resources