我目前正在使用这个(AFKPageFlipper)
为了在我的应用程序中生成所需的翻板动画,有 4 个名为 1.html、2..so 的静态 html 页面
加载视图
- (void) loadView {
[super loadView];
self.view.autoresizesSubviews = YES;
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
flipper = [[AFKPageFlipper alloc] initWithFrame:self.view.bounds] ;
flipper.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
NSURLRequest *urlReq=[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"1" ofType:@"html"]isDirectory:NO]];
;
//[web loadRequest:urlReq];
NSURLRequest *urlReq1=[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"2" ofType:@"html"]isDirectory:NO]];
NSURLRequest *urlReq2=[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"3" ofType:@"html"]isDirectory:NO]];
;
NSURLRequest *urlReq3=[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"4" ofType:@"html"]isDirectory:NO]];
arr=[[NSArray alloc]initWithObjects:urlReq,urlReq1,urlReq2,urlReq3,nil];
flipper.dataSource = self;
[self.view addSubview:flipper];
}
AFKFlipper 的数据源
- (NSInteger) numberOfPagesForPageFlipper:(AFKPageFlipper *)pageFlipper
{
NSLog(@"%i",arr.count);
return [arr count];
}
- (UIView *) viewForPage:(NSInteger) page inFlipper:(AFKPageFlipper *) pageFlipper
{
web= [[UIWebView alloc] initWithFrame:CGRectMake(0, 40, 320, 385)];
[web loadRequest:[arr objectAtIndex:page-1]];
return web;
}
我可以翻阅多个网页视图,但我面临的问题是当我翻到一半时,我看不到我的下一个视图,它似乎是一个空白页面,在我完全翻转我的页面后它被加载
在翻转板中,您可以部分看到下一个视图和部分上一个视图,如果当前视图中途翻转,我应该怎么做才能显示我的下一个视图