2013-12-16 27 views

回答

0

你必須把它寫在你自己的。

  1. 在您的應用程序內部創建一個全屏webView
  2. 要打開的打開頁面
  3. 操作屬性webView.scrollView以成功移動到頁面的底部。
  4. 每次捕獲屏幕截圖
  5. 如果您在底部合併屏幕截圖到一個大圖像。

我相信這是一個最簡單的方法,並在模擬器上運行。

+0

我沒有開發移動應用程序的經驗,我只想測試一個網站而不是移動應用程序。但是,如果您的解決方案有效,則可以爲此目的開發應用程序。 –

0

請參閱下面的代碼。

-(NSData *)getImageFromView:(UIView *)view // Mine is UIWebView but should work for any 
{ 
    NSData *pngImg; 
    CGFloat max, scale = 1.0; 
    CGSize viewSize = [view bounds].size; 
// Get the size of the the FULL Content, not just the bit that is visible 
CGSize size = [view sizeThatFits:CGSizeZero]; 

// Scale down if on iPad to something more reasonable 
max = (viewSize.width > viewSize.height) ? viewSize.width : viewSize.height; 
if(max > 960) 
    scale = 960/max; 

UIGraphicsBeginImageContextWithOptions(size, YES, scale); 

// Set the view to the FULL size of the content. 
[view setFrame: CGRectMake(0, 0, size.width, size.height)]; 

CGContextRef context = UIGraphicsGetCurrentContext(); 
[view.layer renderInContext:context];  
pngImg = UIImagePNGRepresentation(UIGraphicsGetImageFromCurrentImageContext()); 

UIGraphicsEndImageContext(); 
return pngImg; // Voila an image of the ENTIRE CONTENT, not just visible bit 

}

我從this鏈接得到這個代碼。希望它能幫助你。

相關問題