Disable all buttons until finished loading? - objective-c

I have a app where people can delete stuff. I am wanting to disable all my buttons so the user has to wait till the action is done.
I have the setHidesBackButton working, but it looks tacky. I would rather have it just become inactive where if the user taps it, they can't go anywhere.
I have looked into a few things, and wonder what's the best option! (like to replace it with another button).
Please post some code with your answer :)
Thanks in advance,Coulton

Here's what I did: when it was loading, I set the user interaction like this:
self.view.userInteractionEnabled = NO;
Then when it was done, I did this:
self.view.userInteractionEnabled = YES;
Hope I helped some people.

One approach is to put a modal view with user interaction disabled over the whole screen. The view can use transparency to 'dim' the screen and you could add a UIActivityView to this view so the user knows they need to wait for a moment.
If you just want to make the buttons inactive, I've done this before with a transparent view, again set to have user interaction disabled, positioned over the navigation bar.

Related

disable navigation if some condition [react-native-router-flux]

I'm in some component where user can provide some data. If user clicks any button or swipes or do anything to navigate to some different Scene I want to detect if he provided some changes he didn't save and if yes, I want him to stay on the current screen, not navigate, and finally probably show some modal with warning. How can I achieve that with react-native-router-flex?
I've tried many approaches with onExit function f.e but failed to make any use of it...

Xcode 4.2 How to make text field fullscreen

Just a quick question, I can't seem to find any examples so far. I am trying to make a textfield in Xcode go fullscreen when users clicks on it. All i need is the code to expand the field fullscreen so other fields etc. are not visible while the user enters text. Then once the user is finished and clicks done, the previous screen returns with the text entered saved inside the field. Any ideas? Thanks
CGRect oldFrame = myTextFieldOutlet.frame;
myTextFieldOutlet.frame = CGRectMake(0,0,320,460);
...then when you want to restore it to normal...
myTextFieldOutlet.frame = oldFrame;
In fairness, I think you would be better off with a separate view for that textview you present modally (and return the text from), than what you are talking about.

iOS: Restoring the previously visible view when the app returns to the foreground?

I'm developing an iPhone (iOS 5+) app using storyboards. The first screen of the app is a splash/login screen that checks for Facebook credentials and enables you to read and accept Terms And Conditions. In case there are valid stored credentials and the TOC has been previously accepted, this view automatically makes a modal segue (using a cross dissolve effect) to the first "real" application view, a tab bar controller with three tabs.
I'm currently implementing backgrounding and foregrounding logic. The problem is that when pressing the home button and then coming back, the login screen is briefly shown before the correct pre-backgrounding view is restored. (The Default.png of the app is of the login screen background, so it might be either that or a backgrounding-time screenshot of the actual login screen; I haven't tested replacing Default.png yet to tell the difference.)
Why is this? As far as I can tell, backgrounding the app should just take a screenshot of the view that is visible on the screen when, say, hitting the home button, and restore that prior to restoring the actual view functionality when coming back to the foreground. In this case that would be one of the tabs of the tab bar controller. Is the modal segue between the login screen and the tab bar controller the culprit here, or something else?
(I've always felt that the cross dissolve modal segue from the login screen to the first "useful" screen is a bit dirty, since IMHO a modal segue seems to imply that what your segueing to is something you'll later dismiss to get back to the "from" screen. What I'm doing now is just leaving the target of the modal segue visible indefinitely. If that is the problem here, I'd love it if someone would suggest a better method of displaying, transitioning away from and "jettisoning" the login screen.)
OK, turns out this was just a simulator/device discrepancy regarding Default.png. This comment on another question made me think to check. Time to file a bug report.
If I recall correctly, Apple has some old demo code which "remembers" which view a navigation controller was showing before it went into the background.
By way of disclaimer, I haven't worked with storyboards, so I don't know the specifics of doing what you're trying to do.
If it were me, I'd create the view controller or controllers at launch, and then only add the login screen if deemed necessary by the app delegate's logic. Only then, after setting up the view hierarchy, do I present everything.
This accomplishes two things. My login screen only exists and is visible if necessary. Additionally, the login screen won't flash unessecarily. Oh, and as a third benefit, you can present any view you like.
I'd suggest, assuming the aforementioned demo code doesn't work for you, that you'll want to save some sort of reference, tag, or ID of the currently visible view in NSUserDefaults and read that out when setting up your view hierarchy on launch.

Objective C - UITabViewController disable tabBar

I'm using a UITabBarController in my app.
How can I disable people from clicking the tabs?
Trying to disallow people from clicking away to another section before some of the things that is going on is done.
Thank you,
Tee
Figured it out.
UITabBarController.tabbar.userInteractionEnabled = NO;//disable
UITabBarController.tabbar.userInteractionEnabled = YES;//enable
You really shouldn't do that, it's very counterintuitive to the user. Instead of temporarily disabling user interaction with tabbar, present your content in a modal view (it completely overlaps the tabbar making user unable to change the tab).

How to do a pop-up window with textfields in Objective-C?

In the iPhone Objective-C app, I want to pop-up a window (which is smaller than the main view, and the app does not stop running) when a button is tapped, with textField for the user to input text, and dismiss it when it is done.
This is widely used but I really cannot google the relevant content out.
What view should I use to connect it with the button? AlertView (which seems you cannot add dialogue in), ModalView?
Are there relevant info somewhere?
Thanks.
Make the popup it's own, full-sized window. Put a UIImageView in behind your popup screen, and duplicate the results of the normal window. That way, it will look like a popup window, but it still has the proper animation speed and everything. If you do it as a real popup, the game itself will slow down and look jumpy.
You can create any view and use UIViewController's presentModalViewController: to display a modal view controller (and even animate it).