0
我的主要故事板上有一個按鈕。我很確定它是正確的連接,但是當我運行模擬器並按下按鈕時,它什麼都不做。我錯過了什麼讓按鈕打開Safari?iOS xcode按鈕沒有鏈接。
Viewcontroller.h
#import <UIKit/UIKit.h>
@interface testViewController : UIViewController
- (IBAction)openSafari:(id)sender;
@end
Viewcontroller.m
#import "testViewController.h"
@interface testViewController()
@end
@implementation testViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (IBAction)openSafari:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"www.google.com"]];
}
@end
謝謝,加入http修復了這個問題,我很高興它是簡單的東西! –
那就別忘了接受他的回答! – benuuu