Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7180619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:23:11+00:00 2026-05-28T17:23:11+00:00

I have an actionSheet with EDIT and DELETE buttons, both being other buttons This

  • 0

I have an actionSheet with EDIT and DELETE buttons, both being other buttons This is the Code i have written for it

-(void)method1
{

    action = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil     destructiveButtonTitle:nil otherButtonTitles:@"Edit", @"Delete", nil];
     action.actionSheetStyle = UIActionSheetStyleBlackTranslucent;
    [action showInView:self.view];
    [action release]; 

}

I have used the deleate method to assign actions to method..

-(void)actionSheet:(UIActionSheet *)action didDismissWithButtonIndex:(NSInteger)buttonIndex
{
    if(buttonIndex == 0)
    {
        // do something
    }
    if(buttonIndex == 1)
    {
        // do something
    }
}

now the problem is that the actionsheet does not dismiss at one click of either of the buttons.. Please help me with some solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T17:23:12+00:00Added an answer on May 28, 2026 at 5:23 pm

    This appears to be a bug in iOS4.0. I had this issue in my simulator. I changed the version to 4.3 and 5.0 and it seemed ok.

    Edit:

    Seems that my issue was more specifically to do with the actionsheet being launched twice by a delegate method “-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField”

    Not sure why this is called twice in this case but not others (again I assume a iOS 4.0 bug that’s been fixed in later releases). My workaround is to keep track if it’s been called already and not call it a second time.

    Edit 2

    I would suggest doing something like:

    -(void)method1
    {
        if(hasLaunchedActionSheet)
        {
            return;
        }
    
        hasLaunchedActionSheet = YES;
        ...
    

    and:

    -(void)actionSheet:(UIActionSheet *)action didDismissWithButtonIndex:(NSInteger)buttonIndex
    {
        hasLaunchedActionSheet = NO;
        ...
    

    For me, the issue’s not so much in Xcode as it is in the iOS SDK itself calling my event twice. I’m not sure how you’re calling method1 so it might be a different issue with a different event.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: UIActionSheet *actionSheet = [[[UIActionSheet alloc] initWithTitle:@Illustrations delegate:self cancelButtonTitle:@Cancel destructiveButtonTitle:nil otherButtonTitles:
I have this switch statement in my code: switch(buttonIndex){ case 0: [actionSheet dismissWithClickedButtonIndex:buttonIndex animated:YES];
I have this code in the main view controller and it is working just
I have a UIActionSheet in my app that defaults to having 4 buttons. If
I have a UIActionSheet that displays various buttons, one of which posts a tweet
I have a question.In my application I have UIActionSheet with 2 buttons one is
I have been trying this one tonight for a while.... I have a UIActionSheet
I just do not seem to follow this. This is my code -(void)saveClicked:(id)sender{ Item
I have this code to get NSStrings from an NSDictionary from an NSMutableArray but
I have a UIActionSheet that contains buttons that are programmatically added depending on whether

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.