2012-04-11 39 views
0

編輯:這是我的錯,請參閱下面的答案。UIPopoverController無法出現presentPopoverFrom

我得到,爲什麼這不是現在的工作很困惑,我希望你們中的一個可以提供一些建議:

// 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子視圖的視圖。

謝謝。

回答

0

我想通了,我很抱歉地說這是我的愚蠢。

我有myPopovermyPopOver聲明,我是在上述兩者之間跳躍,所以這顯然是行不通的..

所以我想教訓;如果有什麼不工作,請仔細閱讀!

相關問題