Loading screen is not working properly - iphone

In my app I am showing loading screen when request is sent to server and when response is received I am removing that loading screen.
To display loading screen I used UIView and reduce its alpha to 0.5 so that it shows the background view.
My problem is user is able to click button displayed on background view when loading screen is still visible.
What I want is: User should not be able to click anywhere on the screen when loading screen is visible. Even though I made userInteractionEnabled false for UIView but still user is able to click on button, why?
If any one knows where I am doing wrong and how I can achieve this, please let me know.
Thanks in advance!

The UIView may have interaction disabled but if the button is higher on the view hierarchy then its on TOP of the view so it's still accessible.
If this is a view made in the nib then make sure its at the top of the view stack
Or if its programmatically then add it as a subview at the end of the function or add it mainWindow (be VERY careful adding things to main Window, this is the top of the hierarchy)

Like wise the utility open source library available.
iOS open source project is MBProgressHUD,
it refers to Heads Up Display, a view that is overlayed on another view, typically to show an activity indicator and/or offer a means to interact with the UI. A good example of an HUD is when playing a movie with the built in movie player. When you tap the screen, the movie player will show a series of controls on the display. Another common example, and one that is pertinent to MBProgressHUD, is showing progress indicators on top of an existing view. For example, when accessing a remote service, to provide feedback to the user you may opt to display a “Please Wait” message
you can download the source code from here.

Yes I got it, I did userInteractionEnabled false for UIView so the click event was sent to the button which was on main view.I removed userInteractionEnabled false and it is working fine.

You can use [[UIApplication sharedApplication] beginIgnoringInteractionEvents] when you are sending request to server & shows loading view.When you receives the response call [[UIApplication sharedApplication] endIgnoringInteractionEvents] & remove the loading view.

Related

How to show loading of content from YouTube?

I have a UIViewController with a UIScrollView inside it. This scroll view contains a few strings and images, and more recently it's own UIWebView which contains a YouTube video.
As a first case, assuming the user has Internet access, how should I show the user that the box contains content that is currently loading?
Musings:
I was able to place a UIView on top of this UIWebView (within the scroll view) which contained a UILabel with the text "Loading..." inside it. But I was unable to remove/hide the label based on when the video has fully appeared as I could not get viewDidAppear et al to respond. I also have access to a BOOL which tells me if the user has Internet access or not, so the other side to the question would be to set the same label to explain that they have no web access if that is true. (which would explain the presence of a white box in this scroll view)
I also looked at whether it'd be possible to write a custom responder to fire off when the video thumbnail in the web view had finished loading, but again I couldn't get any of the responder methods to be hit for this to work.
In short, how should I be tackling this problem? Thanks in advance for any advice or assistance.
Set your view controller as the web view's delegate. The UIWebViewDelegate protocol defines two methods, -webViewDidStartLoad: and -webViewDidFinishLoad:, that you should be able to use to track when the page has begun to load and (hopefully) when the thumbnail has appeared.

UIView accessibility issue

I've developed an iPhone App and most of it is accessible but I have an issue with one thing I do.
When the user clicks the settings button in the App (it has a main menu with a bunch of buttons for various Applications) I add a UIView on the top and and darken the background screen. Unfortunately for a blind person this UIView doesn't become "active", ie they are still navigating around the background screen.
I initially added the UIView using addSubview: and then tried insertSubview: atIndex: but neither have operated as expected.
Edit: Further information there are text fields and a button on this screen, perhaps I could instead make one of them active or something?? No idea how I would do this though.
How about using becomeFirstResponder? It makes the control receiving this message active and the receiver of input. For UITextView etc. it brings up the keyboard.
I didn't get what you are saying, but I thought there may be problem with the view added on the top.
Do one thing, if you added the view using interface builder then select the view and click on Layout menu in the Menu bar and select "Send to Back".
or else if you add that through code, then write code as
[self.view sendSubViewToBack:addedView];
Regards,
Satya

iPhone, I need to DB refresh func for a few seconds, how can I show progress before a table screen from tab selection?

I'm developing an app which has a tab bar and a UITableView, sometimes I'll need to run a function to update the database, which takes a few seconds. However, this is only needed if they want to look at a certain screen (and the data need updating) which has a UITableView on it.
I want some advice as to how, what, when and where I should show a progress indicator.
I'm thinking that I'll need something which pops up when the table view is about to be shown ?
As I say I don't know what to use to show the progress?
Also where would it be shown, would I need a new screen which is shown before the the table view or can I use and action sheet which will be dismissed automatically ?
Would like some sample code too.
There are many options for what. You can use a UIActivityIndicator (the spinning circle) or a Progress View (thermometer style) or a UILabel with the text xx% or nothing at all. If you're connecting to the Internet to get data, you should also call [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES] to show the spinning circle in the status bar.
Where is entirely up to you. Apple's own apps have put it into toolbars (c.f. EMail), in the middle of an otherwise blank view (c.f. App Store), or in a single UITableViewCell (c.f., Settings. It shows "Loading applications..." at the bottom when the app first starts while loading Settings.bundle from all installed apps.)
How largely depends on the where and what chosen, but in all cases your DB update needs to be in a background thread so you minimize the effect on the UI. If you're using a Progress View or some numerical feedback you'll want to periodically call something like:
[myViewController performSelectorOnMainThread:#selector(updateProgress:) withObject:[NSNumber numberWithFloat:(1.0 * currentRecord / totalRecords)] waitUntilDone:NO]

Blocking UI Interation whilst image is downloading

Im using NSThead and have a loading screen whilst im downloading images form the web to display, whist this is happening, could i stop the UI touch being registered? I have buttons on that view and when the loading screen is up, its basicllya text label which has a slightly transparent background. but if someone clicks on it, it registers the back ground buttons being clicked so i want to avoid that.
I recommend to use a UIAlertView for this.
Override the buttons and provide your own "HideIt" handler wich finally call Dismiss...
UIAlterView is somehow a UIView so you can change it's look.
And it blocks the underlying UI without any extra code.
Also possible - Create a (somehow transparent) UIView which covers your View.
You can place a text and / or a UIActivity... on it to show a loading animation.
When loading starts show this thing - when done hide id.
If you want to update this view (Progress indicator / text) be sure to run the updates on the MainThread.
Manfred

Full Screen Image Preview

Can someone please tell me how to get a full screen image preview view when someone taps on an image view of a nib... like the one in appstore application screenshots....
it will be a real help...
Thanks in advance
The first thing you need to do is subclass UIImageView.
Then in your subclass make sure that user interaction is enabled (either by setting it in code, or by checking the box in IB).
Then you need to override the touches:DidBeginWithEvent: (et al) methods (they're found in UIResponder), and put the code for what you want to happen inside them. For example, you could create a larger image view, and then attach it to the view hierarchy.
As for making it completely fullscreen, you'd need to set the frame of the image view to that of the Window, and hide any Tab Bars, Navigation Bars, Status bars, etc.
You can hide the status bar by using
[[UIApplication sharedApplication] setStatusBarHidde:YES];
Hide navigation bars:
[navigationController setNavigationBarHidden:YES];
so on and so forth. You should be able to find ways to hide most things by looking at their docs.
Hope this helps.
I actually wanted a control like the image preview in photos and that on facebook maybe....
which i found in the open source three20 repository... google it to find out ....