Xcode 4.3.2 上的 uipopover 冻结问题



你好,我只是想用一个矩形按钮制作一个简单的uipopover。 在以前的 Xcode (4.2( 中,我可以毫无问题地运行它,但是当我尝试在 Xcode 4.3.2 iPad 模拟器上运行此代码时,当我按下矩形按钮时它会冻结/挂起。 谁能帮我?这是我的代码

在头文件中:

@interface popViewViewController : UIViewController <UIPopoverControllerDelegate> {

}
-(IBAction)showPop:(id)sender;

@end

嵌入文件:

#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">

谢谢。

显然,问题不在我预期的InfoView中。一个问题,您是否在使用 ARC?如果是这样,请尝试将弹出控制器保留为强属性。对此的可能解释是,在 ARC 中,弹出框将在离开方法时自动释放。如果您不使用 ARC,我没有任何其他线索,对不起。

如果它的帮助是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

最新更新