UIActionSheet添加UIPickerView.
From: http://tsyouaschen.iteye.com/blog/972683
- (void)configurePickersAndActionSheets { CGRect pickerFrame; if ((self.interfaceOrientation == UIInterfaceOrientationPortrait) || (self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)) { pickerFrame = CGRectMake(0, 180, 0, 0); } else { pickerFrame = CGRectMake(0,180,480,200); } self.areaActionSheet = [[[UIActionSheet alloc] initWithTitle:@"Area" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Use",NULL] autorelease]; self.areaPicker = [[[UIPickerView alloc] initWithFrame:pickerFrame] autorelease]; self.areaPicker.delegate = self; self.areaPicker.showsSelectionIndicator = YES; [self.areaActionSheet addSubview:areaPicker];}
上面的代码就是横屏和纵屏的大小设置
if ((self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight)) { [actionSheet setBounds:CGRectMake(0, 0, 480, 480)]; } else { [actionSheet setBounds:CGRectMake(0, 0, 320, 618)]; }
此处用来设置actionsheet的大小具体的添加PickerView如下:UIActionSheet?return?0;}