コントロールをポップオーバー タイトル バーに配置する必要があるのはなぜですか? iPad には、下のビューに配置することを検討するためのはるかに多くの画面領域があります。
- 編集 -
私はそれを自分で試してみましたが、うまくいきます。ポップオーバー コントローラーを設定するコードは次のとおりです。
- (IBAction) showPopover: (id) sender
{
TestController *testController = [[TestController alloc] initWithStyle: UITableViewStylePlain];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController: testController];
UIPopoverController *controller = [[UIPopoverController alloc] initWithContentViewController: navController];
[controller presentPopoverFromBarButtonItem: sender permittedArrowDirections: UIPopoverArrowDirectionAny animated: YES];
controller.delegate = self;
[testController release];
[navController release];
}
TestController の実装は次のとおりです。
- (id) initWithStyle: (UITableViewStyle) style
{
if ( (self = [super initWithStyle: style]) ) {
UISegmentedControl *ctrl = [[UISegmentedControl alloc] initWithFrame: CGRectZero];
ctrl.segmentedControlStyle = UISegmentedControlStyleBar;
[ctrl insertSegmentWithTitle: @"One" atIndex: 0 animated: NO];
[ctrl insertSegmentWithTitle: @"Two" atIndex: 0 animated: NO];
[ctrl insertSegmentWithTitle: @"Three" atIndex: 0 animated: NO];
[ctrl sizeToFit];
// Any of the following produces the expected result:
self.navigationItem.titleView = ctrl;
//self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView: ctrl] autorelease];
[ctrl release];
}
return self;
}
結果は次のとおりです。

sizeToFit
私のコードには、セグメント化されたコントロールに送信する以外にトリックはありません。これはうまくいきますか?