在.h
#import <UIKit/UIKit.h>@interface ThirdVIEwController : UIVIEwController{ UIWebVIEw *myWebVIEw;}@property (nonatomic,retain) UIWebVIEw *myWebVIEw;-(IBAction)goBack:(ID)sender;@end
在.m
#import "ThirdVIEwController.h"@implementation ThirdVIEwController@synthesize myWebVIEw;-(IBAction)goBack:(ID)sender{ [myWebVIEw goBack];}- (voID)vIEwDIDLoad{ [super vIEwDIDLoad]; Nsstring *urlAddress = @"http://www.apple.com"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; [myWebVIEw loadRequest:requestObj]; [self.vIEw addSubvIEw:myWebVIEw]; self.navigationItem.leftbarbuttonItem = [[UIbarbuttonItem alloc] initWithTitle:@"Back" style:UIbarbuttonItemStylePlain target:self action:@selector(goBack:)];}解决方法 初始化您的webVIEw.
UIWebVIEw *tempWebvIEw = [[UIWebVIEw alloc]initWithFrame:theFrame];Nsstring *urlAddress = @"http://www.apple.com";NSURL *url = [NSURL URLWithString:urlAddress];NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];self.myWebVIEw = tempWebvIEw;[tempWebvIEw loadRequest:requestObj];[tempWebvIEw release];myWebVIEw.delegate=self;总结
以上是内存溢出为你收集整理的iphone – 创建UIWebView并以编程方式加载网站全部内容,希望文章能够帮你解决iphone – 创建UIWebView并以编程方式加载网站所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)