Block until UIView loads text? - ios

I have a UIView with paging enabled.
I automaticly scroll to the next page:
[myView scrollToNextPage]
Now here I want the code to block until the next page is finished loading. scrollToNextPage calls a delegate method and I want to wait for it to finish before I keep going.
I'm not sure I want to use notifications because I don't want a notification every time the page is turned, just when I turn the page programaticly.
Thanks!

Related

Xcode Display a loading view until the second view loads (on a segue show)

I have an app that switch views using a segue when a button is clicked.
The second view loads data from the internet and it can take a couple of seconds.
I would like to know how can i display a loading view/splash screen in the meantime so the view could finish the loading and the app wont appear like it's doing nothing.
Thanks!
Check this library SwiftSpinner. It serves the purpose of your needs. It's really brilliant.
Call the necessary function from the library in the viewDidLoad method of your ViewController which loads the data from the internet. Remove this view in DidFinishLoading method of the NSURLProtocol (It's an optional func declared in that class which detects when the request to that URL is complete). The documentation is given in that library itself.
Sounds like you're looking for an activity indicator. I've used the custom class posted https://stackoverflow.com/a/32661590/3516923 with success. Just a note of warning, in his class he blocks all input while the indicator is in view. If you want to make it so your users can back out before things finish you need to remove UIApplication.sharedApplication().beginIgnoringInteractionEvents() and UIApplication.sharedApplication().endIgnoringInteractionEvents() from the start and stop animating functions.
If what you want is really a splash screen, have a UIImageView underneath the view that you're loading. Set the image to your splash screen image. Set the loading view to hidden=YES before it's shown, then set hidden to NO after it finishes loading. You could even set the opacity of the frontmost view to give you a fading effect.
1.You need to find a kind of indicator, suck like an activity indicator or something else to show the loading UI to the user.
2.Set the user interaction unable, so that the user won`t touchup inside repeatedly.
3.Start the indicator, set the user interaction unable when you load the server data, and stop the indicator animation when you finish, hide the indicator, enabled the user interaction.

Programmatically register a 2nd tap event in different coordinates a few seconds after actual tap event in iOS

I am trying to programmatically make a 2nd tap occur on the screen a few seconds after the actual tap event occurs. For example, if I tap the screen in the bottom left corner...is it possible to then programatically make a tap occur at a specified set of coordinates a few seconds later (see image).
You don't need to do horrid things like overlaying invisible buttons and faking taps.
All you need to do is set your view controller to conform to the UIWebViewDelegate protocol, and implement the webView:shouldStartLoadWithRequest:navigationType: protocol method.
By implementing this method and checking for a link-tap event with if(navigationType == UIWebViewNavigationTypeLinkClicked) your app is now being informed of link-taps without intercepting and eating them via invisible buttons, so your web site doesn't miss out on being informed of the request.
You can then implement the necessary logic to change categories in JQuery on the site.

Any way to know before html content was shown in UIWebView

Is any possible ways that I would like to know before html content was shown in uiwebview.
coz when I called to some url, It will take a few seconds to complete the whole page loading. Before loading was completed, some of the content was already shown. I would like to know before that content was shown or before start showing.
UIWebView has a delegate protocol called UIWebViewDelegate. Two methods you should implement are – webViewDidStartLoad: notify monitoring object of when a site will about to load and – webView:shouldStartLoadWithRequest: notify when there a certain request like click, submit, back/forward etc are being made

UIInteractiveTransition and making transition become interactive again

I have a UIInteractiveTransition using a UIPanGesture which calls finishTransition or cancelTransition when it is finished.
However would there be a way to tell iOS the user has started panning again and you would like for it to cancel animating the view controller using the non-interactive portion of the transition and allow you to update manually ?
Call the finish/cancel transition after a delay with performSelector:withObject:afterDelay: and within that time if the gesture callback is received again, cancel the selector, and update the same instance of UIInteractiveTransition with the required percentage. Seems like this should do what you want.

How can I know which ViewController is active?

I am downloading images using NSOperationQueue.
I want to call a method reloadView of my view controller once the image download is complete.
However when the download is in progress, it is fairly possible that user has moved to a different view. This other view will also have a reloadView method (e.g. first view shows total downloaded images count, and second shows thumbnails of download images)
Basically what I want is that whenever an image download is completed, I should be able to call the reloadView method of the active view controller whichever it is?
How can this be possible?
I wouldn't take that approach. This is the kind of thing NSNotificationCenter is designed for. When your image has finished downloading, post a notification. In view controllers that need to know about it, listen for the notification in viewDidAppear: and stop listening in viewDidDisappear:. Your downloading code doesn't need to know the details of your view controllers or their status.

Resources