ios UIButton not loading url in UIWwebview

Saturday, July 5, 2014

I have made an iOS app to load a simple UIWebView *mWeb.


Once the app starts it loads my originalURL. At the bottom of the UI, I have a UIButton placed *btnHome. When I click this UIButton I want it load another URL *loadNextURL.


However something's not working on my end...HELP!


Here's the code for my myViewController.h file.



#import "myViewController.h"

@interface myViewController ()
@property (weak, nonatomic) IBOutlet UIButton *btnHome;
@property (weak, nonatomic) IBOutlet UIWebView *mWeb;

@end

@implementation myViewController

- (void)viewDidLoad
{
[super viewDidLoad];
NSString *originalURL = @"http://myOriginalLink";
NSURL *url = [NSURL URLWithString:originalURL];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[_mWeb loadRequest:requestObj];
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];

}

- (IBAction)btnHome:(id)sender
{
NSString *loadNextURL = @"http://link2";
NSURL *url2 = [NSURL URLWithString:loadNextURL];
NSURLRequest *reqObj = [NSURLRequest requestWithURL:url2];
[_mWeb loadRequest:reqObj];
}

@end






http://ift.tt/1ml8A8q