My iOS/iPhone app starts with a login page (a little like the login page on the Facebook app). There's an info button at the bottom that flips the first view controller onto another that gives a little info about the app to anyone before they login.
What I'm struggling with is that I'm using a UIWebView to display my few paragraphs of body text and a picture, however it's contents is filled in on 'viewDidLoad'. This means that momentarily when I'm 'flipping' between the ViewControllers the info page is blank and only gets filled with my content when the animation is complete.
I have tried setting up the UIWebView inside initWithCoder:(NSCoder *)aDecoder with no luck.
Does anyone have any idea how to render it/have it ready for when it is visible? It looks fine if I leave it and then flip back.
Thanks!
you can "force" the call of the viewDidLoad of the second ViewController in the first with:
[secondViewController view];
with this you can avoid to wait for loading the webview
If I understand this correctly, why not render the second view when the app loads or in the background after the first VC loads and have it hidden, then make it visible it when the user presses the button?
Or maybe just render the webview in the first view controller then pass it to the second view controller when the user presses the button.
Have you tried using the option UIViewAnimationOptionAllowAnimatedContent for the flip animation?
Related
I am trying to create a ver simple app in iOS 7. In this I need move back and forward using UIBarButtonItem. But when I am pressing back button it is loading a view but not showing all UI Controls properly basically the view is empty. in the below as I pressed any of the cell it will move to another view and load respective data.
On the pressing back button it should show earlier image but it is showing following view.
Please tell me where I am going wrong Thanks in advance.
It seems as if your second screen is presented modally. Then you need to make an unwind segue.
Add this code to the viewcontroller that should be returned to:
-(IBAction)backButtonUnwindSegue:(UIStoryboardSegue *)segue
{
}
then from your modal vc, in storyboard. Drag a segue from the "Back"-button to the Green "Exit"-icon and select the backButtonUnwindSegue-action
Check Out this:
Passing Data example
In my app, I would like a loading screen which has a start button, and when the user presses the start button, it displays my the actual parts of my application.
I can't use a Default.png because i need the functionality of the start button. And since my rootViewController is a tabBar, I can't simply add my screen as a subview, because then my loading screen just appears in each individual tab.
Any ideas?
You could create a new view controller and set that view controller as the root view controller. In the new view controller, create a UIImageView with the loading image and a UIButton where you want it. Then you could go in the storyboards and make the button transition to the "actual parts of [your] application".
Hope this helps!
There are several ways to do it. Assuming your app spends very little time in the Start Screen, I would implement it as a modal view controller that I display over the root tab view.
After you load your root tab bar view for the first time, present the Start Screen view controller without animations.
[tabBarViewController presentViewController:startViewController animated:NO completion:NULL];
If you do this early enough (e.g., in your app delegate's didFinishLaunching: method), the start screen will be the first thing the user sees. It's hard to say exactly where you should insert this code since you haven't said whether you are using storyboards or a default nib or loading a view manually etc.
When the button is pressed, simply dismiss the startViewController.
Sorry for the complicated title, but it's hard to explain.
This is the hierarchy I have:
Custom View
Custom View
Push Button
Box
WebView
WebView
The way my code works, is that the 'Box' has a 'setContentView' to one of the 2 WebViews shown above. So basically the Box can have a different WebView at any time.
I have the Push Button, which I want to assign to 'Go Back' on the WebView. But I need this button to 'Go Back' on the WebView which is within the Box.
So whenever the WebViews are switched around, the Push Button should link itself to whichever WebView is in the Box, and visaversa.
Is this even possible?
Thanks in advance everyone!
If you had an IBOutlet for your box (called theBox) defined in whichever custom view your button's action method is in, you can just use this in that action method:
[(WebView *)self.theBox.contentView goBack];
So whenever the WebViews are switched around, the Push Button should
link itself to whichever WebView is in the Box, and visa versa.
Why not use a more conventional arrangement? Make the view controller the button's target, and have the action in the view controller take whatever action is appropriate. In this case, that would be adding the appropriate web view to the box.
Views normally don't know anything about how the application works. They just do what the controller tells them to do.
I have a window-based project with two UITextFields to take input from the user.
Both are in my view controller.
I have to parse stuff in the background, so I need something that blocks user interaction in the meanwhile.
I came across this Cocoa With Love tutorial to create a loading view on top of everything. It actually works pretty well, for the most part; it works when ever the text field resigns first responder.
There is one circumstance where it doesnt work, though. When I type something in the first text field and then select the second one, the loading screen will appear, but the keyboard is on top of it, so the user could type something. I want the loading screen to be on top of the keyboard.
In the tutorial, it says to call the keyboard's superview. What is the keyboard's superview?
I tried the following different snippets in my view controller, but nothing works.
loadingView = [LoadingView loadingViewInView:[self.view.window.subviews objectAtIndex:0]];
loadingView = [LoadingView loadingViewInView:self.view];
loadingView = [LoadingView loadingViewInView:self.view.superview];
How can I make the loading screen appear on top of everything ?
The simple solution is to dismiss the keyboard when you show the loading view. I don't think you're allowed to put anything on top of the keyboard.
That said, you could try using the root window as the view to see if that has any effect.
I am creating an app that reads a text file from the web. WHen the app first runs, I want a splash page to be presented with a logo. I have a SplashViewController and a MainController. I am using some code from a tutorial that allows you to add a subview to the MainController's applicationDidFinishLaunching method and replace the main controller's view with the splash screen (follow so far? Trying my best to explain)
The issue I am having is that I want the splash screen to be present until the data is loaded from the web and animate an activity indicator. However, I am retrieving the data from within the viewDidLoad method in the MainController and the app starts retrieving the data before the splash screen loads so there is a delay before the user sees anything.
Is there another method that I can use to begin the retrieval process after the splash has been displayed?
Have you tried -viewDidAppear: instead of -viewDidLoad:? The former is sent when the view has been added to the window whilst the latter is sent when the view has been loaded (from a nib file), i.e., hasn’t been shown yet.