Action Sheet warning? - iphone

I have added an action sheet in my app. My application is tab bar based app.
I have added this in this way
actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:#"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:#"Take photo",#"Use existing photo",nil];
actionSheet.actionSheetStyle = UIBarStyleBlackTranslucent;
[actionSheet showFromTabBar:self.view];
But it shows warning:
How can I remove it. As the same time I am in the tab in which I want to display the action sheet.

[actionSheet showFromTabBar:self.tabBarController.tabBar];
Try this ,it might help you.

If you are in the tab, shouldn't it be [actionSheet showFromTabBar:self.tabBarController.tabBar];?

If you are use tabbar controller then use like this
[actionSheet showFromTabBar:(UITabBar *)[appDelegate.tabBarController view]];

Related

ios UIActionSheet cancel button doesn't work right

I have this problem:
here is my code:
UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:#"Share the race" delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:#"Send with mail" otherButtonTitles:nil];
popupQuery.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
[popupQuery showInView:self.view];
[popupQuery release];
and everything seems ok, the 2 buttons are showed right, the "send with mail" button is ok, but the cancel catch the click only on the upper side...
here a shot that illustrate the situation:
how can I solve this?
thanks:)
My guess is that the bottom portion of the UIActionSheet extends beyond the bounds of the view, and so doesn't respond to touches.
To test this theory, add another button and see if all upper buttons work fine but the bottom button still exhibits this behavior.
To fix this problem, make sure the view extends to the bottom of the screen. If you have a tabBar in your app, that's going to be my suspect for the problem. You could use showFromTabBar: if you want the sheet above the tabBar, or showFromToolbar: to show it from a toolBar.
If you don't have a bottom bar, then I'm wrong and have no idea.
You should show the action sheet as a subview of the application window, not of the current view.
UIActionSheet *actionSheet = [[UIActionSheet alloc] init...];
// ...
[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
May be it will help others.
Happy Coding :)
use
[actionSheet showFromTabBar:[[self tabBarController] tabBar]];
instead of
[actionSheet showInView:self.view];

Placing textfield in Actionsheet

Is it possible to place a text field in Actionsheet? I try this code:
UIActionSheet *menu = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:#"OK"
destructiveButtonTitle:nil
otherButtonTitles:nil];
UITextField *pickerView_freq_payment = [[UITextField alloc] init];
[menu addSubview:pickerView_freq_payment];
[menu showInView:self.view];
[menu sendSubviewToBack:pickerView_freq_payment];
[menu setBounds:CGRectMake(0,0,320, 300)];
CGRect pickerRect = pickerView_freq_payment.bounds;
pickerView_freq_payment.bounds = pickerRect;
[pickerView_freq_payment release];
[menu release];
but it doesn't show any text field. I found information on displaying buttons in Actionsheet, but I need to place text fields instead of buttons.
How can I do this? Can anyone please help me?
Dont need to do this,
You need to implement alert with textfields for change password purpose check this link
I would strongly recommend against this. UIActionSheet has a very specific purpose on the iPhone, and adding text fields to it probably goes against Apple's Human Interface Guidelines.
Could you tell us why you need a text field? This way, we could suggest a more appropriate construct, like a modal view controller.

UIActionView Opens Higher than it Should

I have an Action Sheet that is called from my root view controller using the code below. That view has a Toolbar on the bottom of the view measuring 44 pixels high. The problem is when the Action Sheet opens it's not at the bottom of the view, the bottom of the Action View is about 20 or so pixels above the bottom of the view so some of the Toolbar is visible below the Action Sheet. Using the same code on other views I have no such problem. How do I remedy this?
Any help is appreciated!
lq
UIActionSheet *actionSheet = [[UIActionSheet alloc]
initWithTitle:nil
delegate:self
cancelButtonTitle:#"Do Something"
destructiveButtonTitle:#"Do Something Destructive"
otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:self.view];
[actionSheet release];
If you have a toolbar, use the -showFromToolbar: method instead of -showInView:.

iphone - weird bug between UIActionSheet and UITabBar

In my tabbar app, i bring up a UIActionsheet from an action, called from a button in a navigation controller title bar.
The UIActionsheet functions as per normal, except for the bottom half of the below button 'cancel', which strangely doesnt respond to touch in the iPhone Simulator. The bottom half of the cancel button is where the UITabBar lies behind, and therefore is probably the problem.
Any ideas?
alt text http://img12.imageshack.us/img12/2166/screenshot20100119at236.png
Solution
My solution was from the first answer. Here is my working example code
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:message delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:#"OK" otherButtonTitles:nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:[UIApplication sharedApplication].keyWindow];
[actionSheet release];
This looks like an UIActionSheet to me...
Anyway, you should show the action sheet as a subview of the application window, not of the current view.
UIActionSheet *actionSheet = [[UIActionSheet alloc] init...];
// ...
[actionSheet showInView:[UIApplication sharedApplication].keyWindow];

create share menu and add images

I've two questions for you, which i can't solve:
1) How do I create a menu like this -->
(source: momolog.com)
.
2) How can I add multiple images like the iApp named HotBook do?
.
Thanks in advance for your help.
Sean
Old post, but this may help others who come across the page...
For #1, that's a UIActionSheet. You can instantiate it with this:
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:#"Share" delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:nil otherButtonTitles:#"On Facebook", #"On Twitter", nil];
[actionSheet showInView:self.view];
[actionSheet release];
Note that your UIViewController must conform to the UIActionSheetDelegate protocol.