Reputation: 33
I am trying to implement 2 Web views using the storyboard, both linked to another online webpage. For some reason I don't get any errors, but only the PricesViewController works. The other VC generates a white page......
I am using these 4 files:
PricesViewcontroller.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
Upvotes: 3
Views: 254
Reputation: 2255
This may not fix your problem, but try this. Change your PricesViewController.h
and ReservationsViewController.h
similarly. Also, what version of Xcode are you using, and what version of iOS are you targeting? You shouldn't need @synthesize
in your .m if you're using a recent version of Xcode and iOS.
@interface PricesViewController : UIViewController
@property (nonatomic, weak) IBOutlet UIWebView *WebView;
@end
IBOutlet
s should not be retained, as this can cause retain cycles. May not be the cause, but good programming practice anyway.
Upvotes: 1