I'm using a UIWebView with text and picture in it.I want to do something like this: when I double tap the picture in the UIWebView, it will become a fullscreen preview model. Could anyone give me some advises or solutions ? Thx very much!
A:
This is what i have at the moment, set the UIWebViews Delegate to self then add this:
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSURL *URL = [request URL];
ImageViewer *imageView = [[[ImageViewer alloc] initWithNibName:@"ImageViewer" bundle:nil] autorelease];
imageView.imageURL = URL;
[self presentModalViewController:imageView animated:YES];
return NO;
} else {
return YES;
}
}
Just make the image a link in the html like you would normally. If you have other links that you don't want to load in a model then you can mod the code to detect if the link being pressed is going to an image otherwise just return YES;
I'm having a little problem with my webview which i have posted here (just incase you get the some problem!!) http://stackoverflow.com/questions/3952047/uiwebview-gets-cleared-after-dismissing-a-fullscreen-modal
Hope this helps!
swaterfall
2010-10-17 04:34:58