隐藏在动作表后面的UIpickerview

时间:2012-05-14 08:42:40

标签: ios uipickerview

我是xcode的新手,第一次是在stackoverflow。我有一个pickerview作为UIActionSheet的子视图。 Pickerview用于为字段选择$ amount。 在 iOS> = 4.2 上,pickerview会按预期显示在操作表的顶部。但是,使用 ios 4.0 / 1 ,操作表将涵盖pickerview,但我可以选择值。

代码

-(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;
}

感谢您的帮助。

0 个答案:

没有答案