2
HI計算器朋友如何在webviewer中的小圖像(如臉書)中顯示一個獨立的viewcontrller全屏圖像?
我在iPhone的Web應用程序,其中很多小的圖像是從網絡服務器加載網頁視圖,當我點擊圖像上的圖像在一個新的視圖控制器打開與Facebook等導航。我怎樣才能做到這一點?給我一些想法和一些示例代碼。
任何幫助將是可觀的。
HI計算器朋友如何在webviewer中的小圖像(如臉書)中顯示一個獨立的viewcontrller全屏圖像?
我在iPhone的Web應用程序,其中很多小的圖像是從網絡服務器加載網頁視圖,當我點擊圖像上的圖像在一個新的視圖控制器打開與Facebook等導航。我怎樣才能做到這一點?給我一些想法和一些示例代碼。
任何幫助將是可觀的。
第一名像這樣在你的HTML(PHP)的圖像:
echo "<a class='yourButton' href='inapp://".$image."'><img src="image.png"></a>";
其中$image
=路徑形象。
然後在webView shouldStartLoadWithRequest
把這個:
if ([request.URL.scheme isEqualToString:@"inapp"]) {
NSString *fullUrl=[NSString stringWithFormat:@"http://DOMAIN.com/%@",request.URL.host];
NSURL *imgpath = [[NSURL alloc] initWithString:fullUrl];
return NO;
}
所以上面將返回imgpath
這是圖像的完整URL時,就可以了用戶點擊。之後,你將必須加載一個新的視圖控制器具有ImageView的裏面,下載與AFNetworking(http://cocoadocs.org/docsets/AFNetworking/1.3.1/)的圖像,並在ImageView的加載圖像:
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 100.0f, 100.0f)];
[imageView setImageWithURL:[NSURL URLWithString:@"http://i.imgur.com/r4uwx.jpg"] placeholderImage:[UIImage imageNamed:@"placeholder-avatar"]];
以上所有都寫在內存中,以便調整自己的代碼我正在實施確切的解決方案,我將發佈完整的工作代碼。順便說一下,這可能是我第一次接受堆棧中的答案!