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.