【发布时间】:2014-06-10 11:07:06
【问题描述】:
首先,这是 iPhone 和 iPad 中的图片
iPhone : http://img4.hostingpics.net/pics/563577Capturedcran20140610125811.png iPad:http://img4.hostingpics.net/pics/315654Capturedcran20140610125901.png
这就是我的做法:
_questionnairePicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0,44.0, 320.0, 250.0)];
_questionnaireActionSheet = [[UIActionSheet alloc] initWithTitle:@"Questionnaire"
delegate:self
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
_questionnaireActionSheet.backgroundColor = [UIColor whiteColor];
_dateActionSheet.backgroundColor = [UIColor whiteColor];
self.selectedIndexQuestionnaire = 0;
self.questionnairePicker.delegate = self;
[self.questionnaireActionSheet addSubview:[self getToolBarActionSheet:self.questionnairePicker]];
[self.questionnaireActionSheet addSubview:self.questionnairePicker];
和
-(UIToolbar *)getToolBarActionSheet:(UIView *)aPicker
{
UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
[pickerToolbar sizeToFit];
NSMutableArray *barItems = [[NSMutableArray alloc] init];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:self action:@selector(pickerDoneClick:)];
UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self action:@selector(pickerCancelClick:)];
UIBarButtonItem *flex = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
target:self action:nil];
if(aPicker.tag == 2) doneBtn.tag = cancelBtn.tag = 2;
[barItems addObject:cancelBtn];
[barItems addObject:flex];
[barItems addObject:doneBtn];
[pickerToolbar setItems:barItems animated:YES];
return pickerToolbar;
}
那么,有人知道解决它的好方法吗?
【问题讨论】:
-
你找到答案了吗?我有同样的问题
标签: ios iphone ipad uipickerview uiactionsheet