4
這裏我加載了webview中的內容以及圖像,我想從webview中獲取圖像並將其加載到imageview中。如何從ios中的uiwebview中獲取圖像
圖像的URL被接收,但圖像沒有加載它到ImageView的
在這裏,我使用的代碼從web視圖拍攝圖像是
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
//Touch gestures below top bar should not make the page turn.
//EDITED Check for only Tap here instead.
if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]]) {
CGPoint touchPoint = [touch locationInView:self.view];
NSUserDefaults * userDefaults = [NSUserDefaults standardUserDefaults];
bool pageFlag = [userDefaults boolForKey:@"pageDirectionRTLFlag"];
NSLog(@"pageFlag tapbtnRight %d", pageFlag);
if(self.interfaceOrientation==UIInterfaceOrientationPortrait||self.interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown) {
NSString *imgURL = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).src", touchPoint.x, touchPoint.y];
NSString *urlToSave = [webView stringByEvaluatingJavaScriptFromString:imgURL];
NSLog(@"urlToSave :%@",urlToSave);
}
}
似乎並沒有在谷歌圖片 – jjxtra 2013-10-26 15:08:02
@PsychoDad你弄清楚如何使之成爲谷歌的圖像攜手? – Crashalot 2014-07-26 01:07:49
我告訴用戶點擊視圖圖像按鈕。從那裏它工作正常。 – jjxtra 2014-07-26 14:59:38