2011-09-07 76 views

回答

1

取决于,如果这是在iPad上,您可以使用UIPopoverController并在其中呈现一个UITableViewController。

如果没有,你可以提出一个UIActionSheet添加UIPickerView或里面一个UITableView ......在这个例子中,我创建一个UIActionSheet,并把它里面一个UIPickerView:

NSString *title = UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation) ? @"\n\n\n\n\n\n\n\n\n" : @"\n\n\n\n\n\n\n\n\n\n\n\n" ; 
      UIActionSheet *actionSheet = [[UIActionSheet alloc] 
              initWithTitle:[NSString stringWithFormat:@"%@%@", title, [entry objectForKey:@"Name"]] 
              delegate:nil cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Ok", nil]; 
[actionSheet setDelegate:self]; 
[actionSheet setTag:row]; 

pv = [[UIPickerView alloc] init]; 
[pv setShowsSelectionIndicator:YES]; 
[pv setDelegate:self]; 
[pv setTag:28]; 
[actionSheet addSubview:pv]; 
[actionSheet showInView:[[[self navigationController] tabBarController] view]]; 
[pv release]; 

的通知“\ n“s,你需要那些为Picker视图腾出空间。结果如下: enter image description here

+0

我收到很多错误和wanrings(未声明的标识符'self'?) –

+0

您可以复制粘贴相关代码吗? – 0xSina

+0

使用未声明的标识符'entry',[actionSheet setDelegate:self]; =>期望的标识符或'(',使用未声明的标识符'row',[pv setShowsSelectionIndicator:YES]; =>期望的标识符或'(' –