2012-05-02 28 views
0

你好我只是試圖從rectbutton做一個簡單的uipopover。在以前的Xcode(4.2)我可以運行這個沒有任何問題,但是當我嘗試在Xcode 4.3.2 iPad模擬器上運行此代碼時,其凍結/掛起時,我按下了矩形按鈕。誰能幫我? 這裏是我的代碼Xcode 4.3.2上的uipopover凍結問題

在頭文件:

@interface popViewViewController : UIViewController <UIPopoverControllerDelegate> { 


} 

-(IBAction)showPop:(id)sender; 


@end 

implemantation文件:

#import "popViewViewController.h" 
#import "infoView.h" 

@interface popViewViewController() 


@end 

@implementation popViewViewController 

-(IBAction)showPop:(id)sender { 

    infoView *infoview = [[infoView alloc] init]; 
    UIPopoverController *pop = [[UIPopoverController alloc] initWithContentViewController:infoview]; 
    [pop setDelegate:self]; 
    [pop presentPopoverFromRect:[sender bounds] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUnknown animated:YES]; 
    [pop setPopoverContentSize:CGSizeMake(300, 200)]; 


} 

這裏是哪裏出錯顯示:

#import "popViewAppDelegate.h" 

int main(int argc, char *argv[]) 
{ 
    @autoreleasepool { 
     return UIApplicationMain(argc, argv, nil, NSStringFromClass([popViewAppDelegate class])); 
    } 
} 

「線程1:信號SIGABRT 「

謝謝。

+0

你可以發佈infoview的代碼嗎?你怎麼添加popViewViewController?我沒有看到您發佈的部分中有任何不正確的內容。 –

+0

實際上這只是一個試用代碼,因爲在我的實際項目中,它只是表現相同(凍結)。這就是爲什麼我創建這個簡單的新項目,我不知道爲什麼它保持凍結。我已經嘗試刪除整個Xcode並重新安裝,但仍然無法正常工作。它非常令人沮喪,知道我的代碼沒有問題。也許我會盡量在以後徹底重裝我的osx獅子。 PS。我有兩個iMac,我使用我的其他iMac上的4.2 Xcode上的代碼,它運行得很好,沒有任何凍結。 ow和我的infoView不包含代碼,只是默認創建的標準。 – redribbon

+0

嗯,我認爲你的代碼有問題,但不是在這個部分。我重新安裝或從scracth開始將無濟於事。我想看看infoView控制器,因爲在我看來,問題出在那裏。 –

回答

0

問題顯然不在InfoView中如我所料。一個問題,你使用ARC?如果是這樣,儘量讓popovercontroller成爲一個強大的屬性。對此的可能解釋是,在離開方法時,彈出窗口會自動釋放。如果你不使用ARC,我沒有任何其他線索,對不起。

+0

對不起,但我真的很喜歡這個。無論如何,ARC是什麼? – redribbon

+0

你應該谷歌它有全部的信息,但它是自動引用計數,也就是說,自動內存管理。您是否嘗試過與伊娃提出的解決方案? –

+0

好吧,ARC真的好像是這個問題。該死的,我一直在浪費我的5天才發現這一點。我現在很高興。再次感謝天使的幫助。 – redribbon

0

如果在這裏它的幫助是InfoView的控制器:

infoView.h:

#import <UIKit/UIKit.h> 

@interface infoView : UIViewController 

@end 

infoView.m:

#import "infoView.h" 

@interface infoView() 

@end 

@implementation infoView 

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 
{ 
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view from its nib. 
} 

- (void)viewDidUnload 
{ 
    [super viewDidUnload]; 
    // Release any retained subviews of the main view. 
    // e.g. self.myOutlet = nil; 
} 

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 

@end