2013-05-04 101 views
0

閱讀this thread,我試圖插入一個鏈接到外部網頁上調用touch inside上的一個按鈕(在xCode 4.6故事板中創建的按鈕)。iOS鏈接到外部頁面

這是操作:

-(IBAction)outLink:(id)sender { 
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"https://www.mysite.com/index.php"]]; 
} 

,這頭文件(.h):

@interface MenuViewController : UIViewController <UITableViewDataSource, UITabBarControllerDelegate>{ 
    IBOutlet UIButton *linkToSite; 
} 

-(IBAction)outLink; 

我有聯繫的按鈕,在故事板的元素,我已經掛了行動到Touch Up Inside事件,但我得到這個錯誤,當我點擊按鈕上的模擬器:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MenuViewController outLink]: unrecognized selector sent to instance 0x717d340' 

回答

0

更改.h類中的方法名稱,並重新連接用於touchupinside事件的插座。

-(IBAction)outLink:(id)sender; 

希望它可以幫助你。

+0

是的,謝謝你,這是它!要在9分鐘內接受 – ghego1 2013-05-04 17:05:10

+0

最受歡迎的傢伙 – 2013-05-04 17:29:17

相關問題