0
基本上我有一個web瀏覽器,當點擊某些文件擴展名時會打開一個新的視圖控制器來查看圖像。在iOS 6中,[webView stopLoading]在停止webview以通過視圖控制器方面完美地工作。在導航時停止webview加載
由於升級到iOS 7,這隻會工作一次或兩次,但然後它會打開webview中的圖像,並通過視圖控制器。
下面是我與以前的工作在IOS 6
任何幫助,將不勝感激。
///////////////
//IMAGE CODE///
///////////////
//Image file links
NSURL *imageURl = [request URL];
NSString *imageFileExtension = [[imageURl absoluteString] pathExtension];
//Image file extensions
NSLog(@"fileExtension is: %@", imageFileExtension);
if ([imageFileExtension hasSuffix:@"png"] || [imageFileExtension hasSuffix:@"jpg"] || [imageFileExtension hasSuffix:@"jpeg"] || [imageFileExtension hasSuffix:@"gif"] || [imageFileExtension hasSuffix:@"bmp"] || [imageFileExtension hasSuffix:@"raw"] || [imageFileExtension hasSuffix:@"PNG"] || [imageFileExtension hasSuffix:@"JPG"] || [imageFileExtension hasSuffix:@"JPEG"] || [imageFileExtension hasSuffix:@"GIF"] || [imageFileExtension hasSuffix:@"BMP"] || [imageFileExtension hasSuffix:@"RAW"]) {
[webView stopLoading];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
//Image manager
WebImageViewController * vc = [[WebImageViewController alloc] initWithURL:[request URL]];
[self.navigationController pushViewController:vc animated:YES];
[vc release];
}else{
//Image file links
NSURL *imageURl = [request URL];
NSString *imageFileExtension = [imageURl pathExtension];
//Image file extensions
NSLog(@"fileExtension is: %@", imageFileExtension);
if ([imageFileExtension hasSuffix:@"png"] || [imageFileExtension hasSuffix:@"jpg"] || [imageFileExtension hasSuffix:@"jpeg"] || [imageFileExtension hasSuffix:@"gif"] || [imageFileExtension hasSuffix:@"bmp"] || [imageFileExtension hasSuffix:@"raw"] || [imageFileExtension hasSuffix:@"PNG"] || [imageFileExtension hasSuffix:@"JPG"] || [imageFileExtension hasSuffix:@"JPEG"] || [imageFileExtension hasSuffix:@"GIF"] || [imageFileExtension hasSuffix:@"BMP"] || [imageFileExtension hasSuffix:@"RAW"]) {
[webView stopLoading];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
//Image manager
WebImageViewController * vc = [[WebImageViewController alloc] initWithURL:[request URL]];
[self.navigationController pushViewController:vc animated:YES];
[vc release];
}else{
//Image file links
NSURL *imageURl = [request URL];
NSString *imageFileExtension = [imageURl absoluteString];
//Image file extensions
NSLog(@"fileExtension is: %@", imageFileExtension);
if ([imageFileExtension hasSuffix:@"png"] || [imageFileExtension hasSuffix:@"jpg"] || [imageFileExtension hasSuffix:@"jpeg"] || [imageFileExtension hasSuffix:@"gif"] || [imageFileExtension hasSuffix:@"bmp"] || [imageFileExtension hasSuffix:@"raw"] || [imageFileExtension hasSuffix:@"PNG"] || [imageFileExtension hasSuffix:@"JPG"] || [imageFileExtension hasSuffix:@"JPEG"] || [imageFileExtension hasSuffix:@"GIF"] || [imageFileExtension hasSuffix:@"BMP"] || [imageFileExtension hasSuffix:@"RAW"]) {
[webView stopLoading];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
//Image manager
WebImageViewController * vc = [[WebImageViewController alloc] initWithURL:[request URL]];
[self.navigationController pushViewController:vc animated:YES];
[vc release];