开发者

How do I scroll a div (overflow:scroll) in a webview programmatically? (cocoa/objective c)

I have a chat client with a webview interface that uses a DIV element with overflow:scroll开发者_运维百科 as the main window. I don't want to scroll the entire webview as it has other elements on that must remain static, just the single DIV element, via code.

I'm aware I can access the main webview scrollview via:

NSScrollView *scrollView = [ [ [ [mywebview mainFrame] frameView] documentView] enclosingScrollView];

I could also use an iframe instead of a DIV and access via (excuse the chaining):

NSScrollView *scrollView = [ [ [ [ [mywebview mainFrame] findFrameNamed:@"myiframe"] frameView] documentView] enclosingScrollView];

...but I have no idea how to access the DIV element's scrollview/(whatever it is) directly. Any ideas anyone?

P.S. I know I could use jquery or similar to scroll via javascript (my current method) but would rather do it all in the main code.

Ta.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜