UIPicker和UIActionsheet不再使用iOS7

您好我的用户界面select器不再适用于iOS7,它popup,但它是空白的。 只发生在iOS7上。

//picker -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{ animationsLabel.text = [optionsArray objectAtIndex:[picker selectedRowInComponent:0]]; if (pickerView==animationsPicker) { animationsLabel.text = [optionsArray objectAtIndex:[animationsPicker selectedRowInComponent:0]]; } } -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{ return 1; } -(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component{ return [optionsArray count]; } -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{ return [optionsArray objectAtIndex:row]; NSLog(@"title options array %lu",(unsigned long)optionsArray.count); } 

而行动:

 -(IBAction)animationActionSheet:(id)sender { UIActionSheet *selectPopup = [[UIActionSheet alloc] initWithTitle:@"\n\n\n\n\n\n\n\n" delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; [selectPopup showInView:self.view]; optionsArray = [[NSMutableArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"6",@"5",@"7",@"8",@"9", nil]; // Create picker animationsPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(10, 160, 320, 100)]; animationsPicker.showsSelectionIndicator = YES; [self.view addSubview:animationsPicker]; animationsPicker.delegate = self; animationsPicker.dataSource = self; [selectPopup addSubview:animationsPicker]; // Animate picker opening [UIView beginAnimations:nil context:nil]; [selectPopup setBounds:CGRectMake(0, 0, 320, 485)]; [UIView commitAnimations]; } 

这是我迄今为止所尝试过的。 之前在操作表中显示选取器从来没有问题,但现在是空白的。 林不知道有没有其他人遇到这个问题,或者你能看到任何错误? 我把所有的东西都印在拣货员身上。

有人告诉我说,在行动表中放置捡拾器是不规范的。 我从来没有遇到任何问题在iOS 6中,但在iOS 7中,我有错误。 我切换到UIView而不是我的采摘的行动表,它工作正常。 我希望这有帮助。

不build议在每个文档的操作表中添加子视图。

“子类化笔记UIActionSheet不是被devise为子类,也不应该为其层次结构添加视图。如果您需要提供比UIActionSheet API提供的定制更多的表单,您可以创build自己的表单,并使用presentViewController以模态方式呈现:animated :完成:”。

苹果正在加强他们对Action Sheets的使用……并且他们提高了这个在iOS 7中工作的意愿,这意味着你必须对它进行编码。

看看我做的这个项目。 这与在一个动作表里面有一个select器实际上是一样的https://github.com/DiscoverPioneer/PickerSlider