1

I am new to xcode and first time at stackoverflow. I have a pickerview as subview of UIActionSheet. Pickerview is used to select $ amount for a field. On iOS >=4.2, pickerview shows on top of actionsheet as expected. However, with ios 4.0/1, the actionsheet covers pickerview, though i can select the values.

The code

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    UIActionSheet *sheet = [[UIActionSheet alloc]initWithTitle:@"Select Bill Amount Before Tips" delegate:self cancelButtonTitle:nil destructiveButtonTitle:@"Done" otherButtonTitles:nil];


    [sheet addSubview:pickerview];
     pickerview.showsSelectionIndicator = YES;


    [sheet showInView:self.tabBarController.view];
    /******** action sheet size   **********/

    CGRect menuRect = sheet.frame;
    CGFloat orgHeight = menuRect.size.height;
    menuRect.origin.y -= 216;
    menuRect.size.height = orgHeight+216;
    sheet.frame = menuRect;



    /**************************************/

    CGRect pickerRect = pickerview.frame;
    pickerRect.origin.y = orgHeight;
    pickerview.frame = pickerRect;
    // [self.tabBarController.view bringSubviewToFront:pickerview];
    [sheet release];

    return NO;
}

thanks for helping out.

giorashc
  • 13,691
  • 3
  • 35
  • 71
  • I guess, the reason is that this is too tricky for old versions. You can create your own control like UIActionSheet by subclassing UIView and adding there your PickerView and action buttons. I would do this way. By the way, this is a nice trick. Thanks. – Denis Kutlubaev May 14 '12 at 14:52

0 Answers0