2013-03-26 3 views
0

iOS에서 FusionCharts을 사용하고 있습니다. 융합 차트가있는 UIWebView을 여러 번로드하는 데 문제가 있습니다. 문제는 하나의 웹보기 만 차트를 올바르게 보여줍니다. 두 번째는 차트를로드하고 렌더링하지만 스크롤보기 후에 올바르게 표시됩니다.iOS에 복수의 퓨전 차트가 표시되지 않습니다.

차트가 스크롤 된 후에 만 ​​차트가 제대로 렌더링됩니다. 이 문제의 원인은 무엇입니까?

감사합니다.

+0

로드가 부숴 보이는 차트입니다. –

답변

0

이 문제는 UIWebView 자체에서 명확한 설명을위한 것입니다. 링크 http://double-slash.net/2010/10/18/using-multiple-ios-uiwebview-objects/ UIWebview를 사용자 지정하여 스핀 잠금 메커니즘을 채택하거나 실행 루프의 렌더링 시간을 늘려서 고정시킬 수 있습니다.

@interface FCXTCustomWebView() 

@property (assign) id idelegate; 

@end 

@implementation FCXTCustomWebView 

- (id)init 
{ 
self = [super init]; 
if (self) 
{ 
    self.delegate = self; 
} 

return self; 
} 

- (id) initWithCoder:(NSCoder *)aDecoder 
{ 
self = [super initWithCoder:aDecoder]; 
if (self) 
{ 
    self.delegate = self; 
} 

return self; 
} 

- (id)initWithFrame:(CGRect)frame 
{ 
self = [super initWithFrame:frame]; 
if (self) { 
    // Initialization code 
    self.delegate = self; 
} 
return self; 
} 

- (void)setDelegate:(id<UIWebViewDelegate>)delegate 
{ 
_idelegate = delegate; 
} 

- (void)stopRunLoop 
{ 
CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop]; 
CFRunLoopStop(runLoop); 
} 

- (void) webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error 
{ 
[self performSelector:@selector(stopRunLoop) withObject:nil afterDelay:.01]; 

if ([_idelegate respondsToSelector:@selector(webView:didFailLoadWithError:)]) 
{ 
    [_idelegate webView:webView didFailLoadWithError:error]; 
} 
} 

- (BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType 
{ 
if ([_idelegate respondsToSelector:@selector(webView:shouldStartLoadWithRequest:navigationType:)]) 
{ 
    return [_idelegate webView:webView shouldStartLoadWithRequest:request navigationType:navigationType]; 
} 
else 
{ 
    return YES; 
} 
} 

- (void) webViewDidFinishLoad:(UIWebView *)webView 
{ 
[self performSelector:@selector(stopRunLoop) withObject:nil afterDelay:.01]; 

if ([_idelegate respondsToSelector:@selector(webViewDidFinishLoad:)]) 
{ 
    [_idelegate webViewDidFinishLoad:webView]; 
} 
} 

- (void) webViewDidStartLoad:(UIWebView *)webView 
{ 
[self performSelector:@selector(stopRunLoop) withObject:nil afterDelay:.1]; 
if ([_idelegate respondsToSelector:@selector(stopRunLoop)]) 
{ 
    [_idelegate webViewDidStartLoad:webView]; 
} 
} 

- (void) loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL 
{ 
[super loadHTMLString:string baseURL:baseURL]; 
CFRunLoopRunInMode((CFStringRef)NSDefaultRunLoopMode, 1.5, NO); 
} 

@end 
관련 문제