編集:それは私のせいでした。以下の回答を参照してください。
なぜこれが機能しないのか、かなり混乱しています。どなたかの提案をいただければ幸いです。
// Initialise and setup the sharing view:
sharePopVC = [[SharePopViewController alloc] init];
// Create the pop-over we're gonna put it in:
myPopover = [[UIPopoverController alloc] initWithContentViewController:sharePopVC];
// Confirm nothing is null or anything odd:
NSLog(@"sharePopVC = %@", sharePopVC);
NSLog(@"myPopover = %@",myPopOver);
// Present the popover:
// Not my ideal parameters but 'safe' ones:
[myPopover presentPopoverFromRect:CGRectMake(100,100,100,100) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
// Does it even believe that it's visible.
if (myPopOver.isPopoverVisible) {
NSLog(@"Popover is there, apparently..");
} else {
NSLog(@"We concede the popover is NOT visible..");
}
コンソール出力:
2012-04-11 17:31:37.345 sharePopVC = <SharePopViewController: 0x19c720>
2012-04-11 17:31:37.348 myPopover = <UIPopoverController: 0x14b180>
2012-04-11 17:31:37.349 We concede the popover is NOT visible..
もちろん、何も表示されません。他の場所でもほぼ同じコードが正常に動作しています。表示されない原因は何ですか?
それが私の四角形と関係がある場合に備えて、UIBarButtonItemから提示しようとしましたが、役に立ちませんでした。sharePopVC.view
また、どういうわけかすべて0に設定されて問題が発生した場合に備えて、私のフレームを強制的に設定しようとしましたが、そこにも喜びはありません。
self.view
この場合、UINavigationController や UIScrollView などのいくつかのサブビューを含むメイン ビューです。
ありがとう。