2013-07-18 50 views
0

在打我的頭在這個...我想使用MJViewPopupViewController並不斷收到以下錯誤:[視圖控制器presentPopupViewController:將animationType:]:無法識別選擇

****-[ViewController presentPopupViewController:animationType:]: unrecognized selector sent to instance 0x8016a30 
2013-07-17 23:35:20.091 DesiTest[1055:c07] ****** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[ViewController presentPopupViewController:animationType:]: unrecognized selector sent to instance 0x8016a30'******* 

爲了簡單起見我試圖建立一個只需一個按鈕的小測試應用程序,點擊會顯示其中包含一個UIView有一個標籤(很簡單)

這裏DetailViewController當是我的代碼:

ViewController.m

#import "ViewController.h" 
#import "UIViewController+MJPopupViewController.h" 
#import "DetailViewController.h" 


@interface ViewController() 

@end 

@implementation ViewController 

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

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

- (IBAction)openView: (id) sender 
{ 
    DetailViewController *dView = [[DetailViewController alloc]initWithNibName:@"DetailViewController" bundle:nil]; 
    [self presentPopupViewController:dView animationType:MJPopupViewAnimationFade]; 

} 

@end 

DetailViewController.m

#import "DetailViewController.h" 

@implementation DetailViewController 

@end 

我真的很感激任何幫助。順便說一句:我在XCode 4.6.3上。提前致謝。

+0

您的視圖控制器是MJViewPopupViewController的子類嗎? – zbMax

+0

嗨zbMax,沒有我的視圖控制器不是MJViewPopupViewController的子類。我只是按照作者的例子。 –

+0

你可以給我一個鏈接到你創建這個地方嗎?我想看看。 – zbMax

回答

1

確保您的「編譯源」設置包含UIViewController + MJPopupViewController.m文件。

+0

有關如何添加文件的參考鏈接: http://stackoverflow.com/a/5763073/1303176 –

0

卡恩的建議奏效。謝謝!!

我添加了UIViewController + MJPopupViewController.m,它給了我編譯錯誤,然後我還添加了「MJPopupBackgroundView.m」文件。

非常感謝所有人:)

相關問題