我是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;
}
感谢您的帮助。