objective c - IOS - No "touchend" event for not fullscreen webview -



objective c - IOS - No "touchend" event for not fullscreen webview -

"ontouchend" not firing when touch ends outside of webview. compile xcode 6, ios 8, iphone 6

i have next layout:

|navigation tab| |left view|web view|right view| |page view|

i can receive touch events, when touch starts , ends, in web view. if start touch in webview , move touch outside of it, stop receiving touchmove events leave webview border, , no touchend event received.

code fot test html file:

<head> </head> <body bgcolor="#cc6" ontouchmove="console.info('move');" ontouchstart="console.info('start');" ontouchend="console.info('end');" ontouchcancelled="console.info('canceled');" > <h1>this test</h1> <p> lore ip sum </p> </body>

code of "viewdidload" function

[super viewdidload]; // additional setup after loading view, typically nib. self.webview = [[uiwebview alloc] initwithframe:self.mainview.bounds]; [self.webview setscalespagetofit:yes]; [self.webview setalpha:1]; /* disable scrolling of web view */ (id subview in [self.webview subviews]) { if ([subview iskindofclass:[uiscrollview class]]) { ((uiscrollview*)subview).bounces = no; } } self.webview.scrollview.bounces = no; self.webview.scrollview.cancancelcontenttouches = no; self.webview.scrollview.scrollenabled = no; self.webview.backgroundcolor = [uicolor magentacolor]; //[uicolor colorwithred:(45.0/255.0) green:(50.0/255.0) blue:(53.0/255.0) alpha:1]; self.webview.autoresizingmask = uiviewautoresizingflexibleleftmargin| uiviewautoresizingflexibletopmargin | uiviewautoresizingflexiblerightmargin | uiviewautoresizingflexiblebottommargin | uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth; [self.mainview addsubview:self.webview]; nsstring * localhtmlfilepath = [[nsbundle mainbundle] pathforresource:@"main" oftype:@"html" indirectory:@"www"]; nsstring *html = [nsstring stringwithcontentsoffile:localhtmlfilepath encoding:nsutf8stringencoding error:nil]; [self.webview loadhtmlstring:html baseurl:nil];

how can fixed? there configuration missed?

complete source code can found here: https://github.com/daraku/webviewbug

i have been strugling same past 30minutes, in end i've decided implement timeout getting restored every touchmove , starts on touchstart, , gets cleared on touchend. timeout lets 1500ms, , if don't touchend fired within webview should, fire when timeout ends.

hope made point. not perfect serves partial fix. in case hackaround iscroll( _execevent('scrollcancel') )

ios objective-c iphone webview uiwebview

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -