gpt4 book ai didi

ios - 调试 xcode 阶段?

转载 作者:行者123 更新时间:2023-11-29 03:11:58 28 4
gpt4 key购买 nike

我遇到一个错误,我已经为网络制作了一个 UIPageController,但我似乎无法找到它的问题,只有一个错误,请帮忙。代码如下 - 更多代码点播。

@interface ContentViewController ()
@end
@implementation ContentViewController
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[_webView loadHTMLString: _dataObject baseURL:[NSURL URLWithString:@"http://"]];
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
}
@end

[_webView loadHTMLString: _dataObject baseURL:[NSURL URLWithString:@"http://"]];

我的“错误在上面”

请帮忙

#import <UIKit/UIKit.h>

@interface ContentViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIView *webView;
@property (strong, nonatomic) id dataObject;
@end

最佳答案

将 .h 文件更改为:

#import <UIKit/UIKit.h>

@interface ContentViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIWebView *webView;
@property (strong, nonatomic) id dataObject;
@end

除此之外,如果你想从 url 加载 UIWebView 中的网页,那么你可以这样做:

self.webView.delegate = self;
self.webView.scalesPageToFit =YES; // This will fit the page within the screen
NSURL *Url = [NSURL URLWithString:@"http://facebook.com/xxx/xxx"];
NSURLRequest *req = [[NSURLRequest alloc] initWithURL:Url];
[self.webView loadRequest:req];

如果你想从文档中加载一个 HTML 文件,那么做:

NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"Test" ofType:@"html"];
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
[webView loadHTMLString:htmlString baseURL:nil];

或者如果你只想加载一个字符串,那么做:

NSString* htmlString = @"";
[webView loadHTMLString:htmlString baseURL:nil];

希望这有帮助.. :)

关于ios - 调试 xcode 阶段?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22161027/

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