Search code examples
iphoneioswebviewflipboard

how to eliminate the blank frame while flipping over to the next view


i am currently using this(AFKPageFlipper)

to produce the desired flipboard animation in my application ,there are 4 static html pages named 1.html,2..so on

loadView

- (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];

 }

data source for the 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;
}

i can flip across multiple webviews,but the problem i am facing is when i am halfway flipping the page i cant see my next view,it seems to be a blank page,it gets loaded after i flip my page completely enter image description here

In the flipboard you can see the next view partially and previous view partially,what should i do to show my next view when the current view if halfway flipped


Solution

  • I tried AFKPageFlipper,, but i dont think messing with its original code is any solution. what u can try is, keep ready all the views u r going to provide to AFKPageFlipper.

    NSMutableArray *webViewArray;
    
    -(void)viewDidLoad
    {
      webViewArray=[[NSMutableArray alloc]int];
      for(int ii=0;ii<4;ii++)
       {
        web= [[UIWebView alloc] initWithFrame:CGRectMake(0, 40, 320, 385)];
       [web loadRequest:[arr objectAtIndex:ii]];
       [webViewArray addObject:web];
       web=nil;
    
       }
    
    }
    
     - (UIView *) viewForPage:(NSInteger) page inFlipper:(AFKPageFlipper *) pageFlipper
    {
      return [webViewArray objectAtIndex:page];
    
    }