Disqus
에서 웹 페이지를 표시 하고 UIWebView
있습니다. 페이지에는 장치에 맞게보기 크기를 조정하는 모바일 버전이 있습니다. 내 문제는 UIWebView
콘텐츠를 장치 너비로 설정하는 반면 webView는 장치 너비의 절반 정도입니다. 이 때문에 웹뷰를 오른쪽과 왼쪽으로 스크롤 할 수 있습니다. 나는 이미 다음과 같은 것을 시도했습니다 : SOF 질문 , 설정 contentSize
등이지만 결과는 없습니다.
완전히 작동하는 다음 스 니펫으로 완료했습니다.
[aWebView loadRequest:aRequest progress:nil success:^NSString *(NSHTTPURLResponse *response, NSString *HTML) {
NSMutableString *mutableString = [[NSMutableString alloc] initWithString:HTML];
NSRange range = [mutableString rangeOfString:@"width=device-width"]; // or whatever you have in response
[mutableString replaceCharactersInRange:range withString:[NSString stringWithFormat:@"width=%d", (int)CGRectGetWidth(aWebView.frame)]];
return mutableString;
} failure:nil];
제 동료에게 아이디어를 주셔서 감사합니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다