gpt4 book ai didi

iOS xcode 按钮未链接。

转载 作者:行者123 更新时间:2023-11-29 04:39:37 25 4
gpt4 key购买 nike

我的主 Storyboard上有一个按钮。我很确定它已正确链接,但是当我运行模拟器并点击按钮时,它什么也没做。我缺少什么来获取打开 Safari 的按钮?

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

最佳答案

URL 需要方法和地址,因此请尝试 @"http://www.google.com"。要证明您的操作是否正确连接,请从该方法打印一条日志消息(或使用断点)。

关于iOS xcode 按钮未链接。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10591218/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com