gpt4 book ai didi

iphone - 两个 uiwebview 但只有一个有效

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:20:42 24 4
gpt4 key购买 nike

我正在尝试使用 Storyboard实现 2 个 Web View ,它们都链接到另一个在线网页。出于某种原因,我没有收到任何错误,但只有 PricesViewController 有效。对方VC生成白页……

我正在使用这 4 个文件:

价格 View Controller .h

#import <UIKit/UIKit.h>

@interface PricesViewController : UIViewController

{
IBOutlet UIWebView *WebView; }

@property (nonatomic, retain) UIWebView *WebView;

@end

PricesViewController.m

 #import "PricesViewController.h"

@interface PricesViewController ()

@end

@implementation PricesViewController @synthesize WebView;

- (void)viewDidLoad {
[WebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.sparein.be/full_pricelist.pdf"]]];
[super viewDidLoad];

}


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self; }

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

@end

ReservationsViewController.h

#import <UIKit/UIKit.h>

@interface ReservationsViewController : UIViewController

{
IBOutlet UIWebView *WebView2; }

@property (nonatomic, retain) UIWebView *WebView2;

@end

ReservationsViewController.m

#import "ReservationsViewController.h"

@interface ReservationsViewController ()
@end

@implementation ReservationsViewController @synthesize WebView2;

- (void)viewDidLoad {
[WebView2 loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.google.be"]]];

[super viewDidLoad];
}


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self; }

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

@end

最佳答案

这可能无法解决您的问题,但请试试这个。以类似的方式更改您的 PricesViewController.hReservationsViewController.h。另外,您使用的是什么版本的 Xcode,您的目标是什么版本的 iOS?如果您使用的是最新版本的 Xcode 和 iOS,则您的 .m 中不需要 @synthesize

@interface PricesViewController : UIViewController

@property (nonatomic, weak) IBOutlet UIWebView *WebView;

@end

IBOutlet 不应保留,因为这会导致保留循环。可能不是原因,但无论如何都是良好的编程习惯。

关于iphone - 两个 uiwebview 但只有一个有效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18589849/

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