2011-09-07 38 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]; =>期望的標識符或'(' –