0

こんにちは私は、rectbuttonから単純なuipopoverを作成しようとしています。以前のXcode(4.2)では、これを問題なく実行できますが、Xcode 4.3.2 iPadシミュレーターでこのコードを実行しようとすると、rectボタンを押したときにフリーズ/ハングします。誰かが私を助けることができますか?これが私のコードです

ヘッダーファイル内:

@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」

ありがとう。

4

2 に答える 2

0

明らかに、問題は予想どおり InfoView にはありません。1 つ質問があります。ARC を使用していますか? その場合は、popovercontroller を強力なプロパティに保つようにしてください。これについて考えられる説明は、ARC では、メソッドを終了するときにポップオーバーが自動的に解放されるということです。ARC を使用していない場合は、他に手がかりがありません。申し訳ありません。

于 2012-05-03T18:20:38.927 に答える
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
于 2012-05-03T17:06:43.533 に答える