如何在UIWebView中进行分页?
我的资源文件夹中有十个本地 HTML 文件,我想执行像 ScrollView
和 ImageView
这样的分页效果,所以请帮助我如何做到这一点。我已经在 webView
中显示了 HTML 页面,但我没有更多的想法。我的代码是(但仅适用于一页):
arrHtmlPage=[[NSMutableArray alloc] initWithObjects:@"2",@"3",@"5",@"6",@"8",@"9",@"11",@"13",nil];
NSBundle *bundle = [NSBundle mainBundle];
NSString *htmlTemplateLink = [bundle pathForResource:@"2" ofType:@"htm"];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlTemplateLink]];
wview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 768, 940)];
wview.scalesPageToFit = YES;
[wview loadRequest:request];
wview.delegate=self;
//wview.multipleTouchEnabled=YES;
wview.userInteractionEnabled=YES;
[self.view addSubview:wview];
I have ten local HTML files in my Resource folder and I want to performing paging effect like ScrollView
and ImageView
so please help me how I can do that. I have displayed HTML page in webView
, but i don't have any more ideas. My code is (but it's for only One page):
arrHtmlPage=[[NSMutableArray alloc] initWithObjects:@"2",@"3",@"5",@"6",@"8",@"9",@"11",@"13",nil];
NSBundle *bundle = [NSBundle mainBundle];
NSString *htmlTemplateLink = [bundle pathForResource:@"2" ofType:@"htm"];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:htmlTemplateLink]];
wview=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 768, 940)];
wview.scalesPageToFit = YES;
[wview loadRequest:request];
wview.delegate=self;
//wview.multipleTouchEnabled=YES;
wview.userInteractionEnabled=YES;
[self.view addSubview:wview];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 xcode 4.3.1 中创建一个新项目。文件->新项目->基于页面的应用程序。将 UIWebView 拖放到故事板上。
In xcode 4.3.1 create a new project. File -> New project -> Page-Based application. Drag and drop a UIWebView onto the storyboard.