1

我是 xcode 的新手,也是第一次使用 stackoverflow。我有一个 pickerview 作为UIActionSheet. Pickerview用于为字段选择 $ 金额。在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;
}

感谢您的帮助。

4

0 回答 0