iOS action sheet - iphone

I'm using UIActionSheet in one of my applications and I have a question . When the action sheet comes to front , everything else goes in background and I cannot interact anymore with my buttons or other objects in my view until I dismiss the action sheet . Is there a way to disable this feature ? I mean , if I have the action sheet displayed , can I still be able to use what goes in background ? If there is a way , I would really appreciate if you could show me how to do it.

There is no way to access the Background controls, If the UIActionSheet or UIAlertView comes to the front.

The action sheet is supposed to be modal. All user input will be captured by the action sheet until it is dismissed. So all the background controls cannot be interacted with by the user until it is gone.

Related

Any way to prevent UIActionSheet from being dismissed when user clicks a button in it?

I added a UIProgressView to my UIActionSheet to indicate the download progress. So I do not want my UIActionSheet to be dismissed when user click the download button in it.
But is there a way to do that ?
Right now I implement didDismissWithButtonIndex delegate method to show UIActionSheet again after it was dismissed. But I was hoping there is a better way.
UIActionSheet is a modal view, which means that it blocks UI completely. Since blocking UI is considered a bad practice, preventing an action sheet from dismissing is not supported. Instead, you should make a completely separate progress indicator outside the action sheet.
#Yar, thanks for the answer, I will try your solution some other time.
But I am also satisfied with my current solution. UIActionSheet.h said
// Called when a button is clicked. **The view will be automatically dismissed after this call returns**
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex;
So I guess hit any buttons will always dismiss action sheet. Then my solution is first hide progress bar; when user hits download button, show action sheet again but hide the download button and show progress bar.
The cancel button is always there in case user wants to cancel download even after download is started.

What is the view or thing called that pops up in the photos app when you click the leftmost button at the bottom of the screen on the iPhone?

I want to implement this on my app. I want to search for tutorials on this topic but I don't know what its called. Can someone please tell me what its called? Eg. In the photos app in iPhone, when u click on the left most button at the bottom, a screen pops up from the bottom giving you options to either email image, set as wallpaper etc.. So, once again, what is this called? Thanks
That is a UIActionSheet. Check out the UIActionSheet Class Reference.
Basically you create one with the designated initializer -initWithTitle:delegate:cancelButtonTitle:destructiveButtonTitle:otherButtonTitles: then send the -showInView: message to display it. You'll have to set yourself as it's delegate in order to handle selections made by the user.
The button is the 'action' barButtonItem type.
The button then opens a modal sheet. Opened with something like:
[self presentModalViewController:menuViewController animated:YES];

Regarding Alert View

I am developing one iphone app, when i am clicking on a button i want to show one view which will take the user value for this i am using alert view instead of simple UIView so is it ok to use it b'cos,
I heard if i am using alert view then app will rejected on itunes is this true or we can use alert view.
Thanks & Regards,
Priyanka.
Hi Priyanka as per your problem it seems when the alert view is popped up you want to get some data from user right, so you can do that by taking textfield into uialert view and apple does allow what i said .
Hope this helps.

add new window or view on the alertview click button in iphone

i juzz want to know that how we can add new window or view on the click of an alertview button in iphone?
I'm not sure you can do that from an AlertView since alertviews are meant only to display a specific alert not to take an action. I guess you better off using an ActionViews which is recommended by Apple if you want to perform a certain action from a model view in iphone.
Regards,

Change UIActionSheet after doing it's job

I have to import some XML data into my app.
Now I open a UIActionSheet and add as a subview a UIActivityIndicatorView. Initially I show a progress wheel and a button with 'Cancel'.
When the XML has been imported, I want to hide the progress wheel (this it's easy) and change the button into a 'Done' button, all in the same UIActionSheet.
What I'm doing now is closing the UIActionSheet with the option dismissWithClickedButtonIndex, but I don't like this way because it's the same as pressing 'Cancel', and then I show an UIAlertView displaying "All data has been imported".
Is this possible ?
You shouldn't be doing that, when it loads correctly just dismiss the ActionSheet. On the other hand if an error occurs then display an alert.
Think about the user who will use the app multiple times a day, a Done message each time will be a waste of time.
UPDATE
As i understand your goal is to use the ActionSheet just as a popup (with Cancel ability), if so, just call dismissWithClickedButtonIndex:animated: when your XML loading is done.
If its successful then just call the dismiss method, if its unsuccessful then call the dismiss and popup an alert
This is a bit of a hack but should work. Note that there is a good chance that this will result in your app not being accepted into the app store as you're messing around with the action sheet in ways Apple didn't intend.
Initially display the action sheet with both the 'Done' and 'Cancel' buttons. Before displaying the sheet hide the 'Done' button using its hidden property. To see how to access the 'Done' button see this question.
Then when you're hiding the UIActivityIndicatorView, also change the hidden property of both the 'Cancel' and 'Done' buttons, so that the 'Done' button becomes visible. If the 'Done' button appears in the wrong position move it by modifying its centre property.