开发者

Add drawing objects to UIWebView

Basic 开发者_JAVA百科question - I have a UIWebView with a pdf document loaded.

How can I add drawing objects (eg. a symbol) to this UIWebview's scrollView layer.

Cheers


try this.

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    [self.window makeKeyAndVisible];
    [web loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://tiny4.org"]]];
    UIScrollView* scrollView =  [[web subviews] objectAtIndex:0];
    web.backgroundColor = [UIColor clearColor];
    scrollView.backgroundColor = [UIColor clearColor];
    UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(0, 40, 100, 20)];
    label.text = @"testasdasdasda";
    [window addSubview:label];
    [window bringSubviewToFront:web];
}


I found that by accessing the UIWebViews UIScrollView using

UIScrollView *myWebScrollView = [[myWebView subviews] objectAtIndex:0];

I can add objects to this layer. In combination with Mithin's solution for hooking onto Tap-events, it allows full control of the content ...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜