简体   繁体   English

Xcode 4.3.2上的uipopover冻结问题

[英]uipopover freeze issue on Xcode 4.3.2

hello I'm just trying to make a simple uipopover from a rectbutton. 你好,我只是想从rectbutton做一个简单的uipopover。 in previous Xcode (4.2) i can run this without any issue, but when i try to run this code on Xcode 4.3.2 iPad simulator, its freeze/hang when i pressed the rect button. 在以前的Xcode(4.2)中,我可以毫无问题地运行此代码,但是当我尝试在Xcode 4.3.2 iPad模拟器上运行此代码时,当我按下rect按钮时,它会冻结/挂起。 can anyone help me? 谁能帮我? here is my code 这是我的代码

in header file : 在头文件中:

@interface popViewViewController : UIViewController <UIPopoverControllerDelegate> {


}

-(IBAction)showPop:(id)sender;


@end

implemantation file : 实现文件:

#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)];


}

here is where the error show : 这是错误显示的地方:

#import "popViewAppDelegate.h"

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

"thread 1 : signal SIGABRT" “线程1:信号SIGABRT”

thanks. 谢谢。

if its help here is the infoView controller: 如果它的帮助在这里是infoView控制器:

infoView.h : infoView.h:

#import <UIKit/UIKit.h>

@interface infoView : UIViewController

@end

infoView.m : 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

Clearly the problem is not in the InfoView as I expected. 显然,问题不在我期望的InfoView中。 One question, are you using ARC? 一个问题,您在使用ARC吗? if so, try to keep the popovercontroller into a strong property. 如果是这样,请尝试将popovercontroller保留为强属性。 The possible explanation for this is that in ARC the popover will be automatically released when leaving the method. 对此的可能解释是,在退出方法时,在ARC中弹出窗口将自动释放。 If you are not using ARC I dont have any other clue, sorry. 如果您没有使用ARC,那么我没有任何其他提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM