vendredi 8 mai 2015

Blank Page in UIView

I created a simple app with a web view but it doesn't appear. Only a blank page is shown. My .xib contains the UIWebView

My file ViewController.h:

#import <UIKit/UIKit.h>

@interface TestAViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIWebView *webview;

@end

My file ViewController.m:

#import "TestAViewController.h"

@interface TestAViewController ()

@end

@implementation TestAViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];

    if (self) {

        // Custom initialization
    }

    return self;
}

- (void)viewDidLoad
{
    // Do any additional setup after loading the view, typically from a nib.

    //load url into webview
    NSString *strURL = @"http://www.google.it";
    NSURL *url = [NSURL URLWithString:strURL];
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
    [self.webview loadRequest:urlRequest];


}

@end

Why is this happening? Thanks.

Aucun commentaire:

Enregistrer un commentaire