I currently have a series of 8 separate html files, with the idea that each one is a separate page in an iPad app. I have used jQuery Mobile to implement the page swipe between pages by using the 'data-next' and 'data-prev' attribute. However, the results are not great as i sometimes get a page flicker when i swipe, and css animations are very choppy when I test it on an actual iPad. I am also getting a 1 second delay before the actual swipe happens. I know JQM has a default delay of 300ms, but this is waaay longer! I have tried using the css 'translate3d' technique on animated elements, but it doesn't seem to fix it. I'm putting it down to JQM just being buggy as hell.
So my question is this..Is it possible to bring these files into Xcode, as separate independent html files, and implement the page swipe within Xcode itself?
No Not possible.
XCode allows you to create/edit UI and Transitions of cocoa touch controls only. However you can just edit these html/javascript files in XCode.
Related
I use ScrollMagic to trigger animations on each section of a web page. This works great for desktop and for some browsers on mobile.
However there are some mobile browsers (older versions of Safari and Chrome (on ipad)) that don't play these animations until the scrolling event is finished. I know there are ways around that. However instead, I would like to simply turn off these animations when not supported.
Is there a way to detect that with Modernizr? Or would I have to target specific browsers and its versions?
You wouldn't detect parallax animation. That isn't a browser feature, that is something that you can use browser features to accomplish.
In this case you would you be looking to detect if you are reflow the page during a scroll, or if it waits until after the scroll event fires. There is currently no detect for this, and creating one would get pretty greasy.
I believe what you are seeing is the result of the scroll event not firing as you scroll on certain browsers. I cannot think of a way to simulate this with javascript (triggering a scroll event will obviously only trigger one scroll event, so there isn't anything to gain there). As a result, I am not confident that you would ever be able to accurately detect this.
I completely agree with Patrick's answer, but would like to add that it is indeed possible to have immediate scroll events on the mobile versions of chrome and safari, you are talking about.
The issue you're describing is related to all iOS devices before version 8.
Before then the mobile browser engine did not trigger "true" scroll events while scrolling, but only once scrolling had come to a full halt (so after the inertia stopped). Even the execution of javascript was suspended, so you couldn't just run a loop to check the scroll position.
Long story short: There are ways around it using containers for scrolling and requestAnimationFrame.
The easiest way I found to get scroll events for pre iOS8 devices is iScroll.
I would recommend to check out this: http://janpaepke.github.io/ScrollMagic/examples/advanced/mobile_basic.html
and this:
http://janpaepke.github.io/ScrollMagic/examples/expert/mobile_advanced.html
So getting back to your original question: How to detect when you would even need those workarounds.
You'd need to check if the you're on iOS version 7 or lower, which, to my knowledge, can't be done with modernizr, as it is a feature detection library.
So check out this thread to learn more: Detect iOS version less than 5 with JavaScript
I have tried to get the data-role="backbutton" kendo mobile ui feature to work but I am having issues. When testing the app on my iPhone 4 I get stuck in my app because the back button breaks the UX.
What happens is that when I am testing, I click heaps of back buttons (as they are used quite heavily in my app) and then randomly one decides to slide the previous view into the screen but only goes halfway and then snaps back (or some other type of visual glitch occurs). Then after that, all my navigation breaks down and I get stuck in the last view that I was in. Or better yet the links go to places that they are not supposed to. My tab bar does not work and either do links in the header. I have to exit the app completely, remove it from operating and try again. Seriously something wrong going on here.
I have tried to programatically add the back button by following the Kendo UI documentation but that does not work either. I am left with a button that does absolutely nothing when clicked - it may not even solve the issue anyway. I have looked using developer console in Google Chrome but I can't see any obvious issues.
Has anyone using Kendo Mobile UI experienced this issue before?
I downloaded the latest release of the Kendo UI build and the problem seems to have been resolved. Surprising! I assumed the Kendo framework was a bit more mature to be experiencing such a big issue. It was occurring when using slide transitions in navigation. Here is a link to the bug post on Github https://github.com/telerik/kendo-ui-core/issues/66
This is really weird behavior. Having difficulty even quantifying. Have had to revise a few times.
Best I can do is the following:
The tech stack for my app is Backbone Marionette, handlebars.js, require.js.
The app contains images mostly of icon size - say 32x32 and under. Some jpg, some png, some svg.
Some of the images, the same ones each time, don't display. That's a common issue on which many have posted. No big news there.
But if I hit the sleep button, leave the iPad sit for a minute or two until the unit really goes into hibernate mode, and then revive it, the images slowly and magically fade in. They don't abruptly display when the screen lights. They fade in afterward.
Doesn't work to just hit the sleep button and instantly revive. Have to wait a minute until it truly hibernates.
After true hibernation, no matter how many times I refresh the page, the images are there. But, if I go and clear the cache on Safari and load the page, the images are not there again - until I do that hibernate thing.
All of these images do display without fail in a browser on a PC (all flavors). It's just on the iPad that they don't.
I thought, at first, it was just images I was loading in collection views. It is not. I have a third party HTML5 video player in the app. It has a play button and other controls in svg format. This also exhibits the behavior above.
Once the iPad has hibernated and been revived, the images fade in. Only clearing cache makes them disappear again.
There are no 404 errors when the images don't display (checked in dev console on a MAC). In fact, if I just tap the screen where the video play button is supposed to display, the player begins. So the button seems to actually be there, just not painted on the screen - until you do that hibernate thing.
Some images in the app always load no matter what. I'm looking at those images to see if I can note anything special about them or the code which renders them.
I tend to think it's not the images themselves because the very same images in a plain web page always display on the iPad. Also, that third party video player in a plain web page displays the svg play button and controls without fail on the iPad.
It's just in my app that the behavior occurs. So it's logical to think my app is where the problem lies. I just can't seem to find a common thread for the images that always work vs ones that don't.
Not sure what code I can even post here. I'll look and see what might make sense to post.
Definitely a problem loading images dynamically via the framework. They are there but do not paint. No idea what the problem actually is. Literally only happens on Safari mobile browser. Can't make it happen anywhere else, even old IE. Know one solution that definitely works though. Preload all the images by explicitly including them in a div in your markup. When you load your marionette app, remove the div - $("#preload-images").remove(). Thereafter the images never fail to paint when added dynamically via marionette.
If I limit WebBrowser's height, and content is longer, scrollbar is created inside the WebBrowser (effectively, HTML page is long), similar to IE in WP7. This scrollbar behaves the way I want to - after swift swipe it continues to scroll, slowing down.
But if I place a div with a scrollbar in the WebBrowser content, this scrollbar behaves like regular HTML scrollbar, it does not keep scrolling after user stops touching the display.
Is there a way to make this work too ?
Thanks
No, not easily. The WP7 IE9 browser control supports the overflow:scroll CSS property that allows the user to scroll content within the current page. It is worth noting that most Android and iPhone browsers do not support this, although it has been added in iOS5. None of these browser support inertia scrolling for overflow:scroll, WP7 included.
The only way to get inertia scrolling for overflow content is to do it yourself using JavaScript. For WebKit browsers there is a popular library, iScroll, that provides this functionality. However, it does not work for WP7 (due to lack of CSS3 3D transforms that are used to push the scrolling content onto a different layer for hardware acceleration) - so you will need to write your own implementation. Good luck!
In a cocoa / Mac app I am using a WebView to load a series of YouTube videos (5). When it is loading my whole application locks up for 5 seconds or so.
Is there a way I can load it so it doesn't freeze the rest of the application?
Thanks
eg:
[[webView mainFrame] loadHTMLString:html baseURL:[NSURL URLWithString:#"http://youtube.com"]];
Unfortunately, you cannot render a WebView except on the main thread. This is a basic limitation of the class. I would begin investigating why your page takes so long to render. My hunch: Javascript or a plugin.
I usually like to start by using Safari to see if it has the same issues. You can drag an HTML file onto Safari to load it easily. If Safari shows the same problem, then you can use Safari's Develop tools to profile it. (Preferences, Advanced, Show Develop menu in menu bar.)
If Safari doesn't have a problem, that's actually good, because it means your problem is definitely solvable (if Safari can do it, you should be able to achieve the same thing). Here are some things to try out:
Instruments. Try to see what WebView is taking its time on. Focus first on "all samples" for the main thread. This is usually what leads to the app hanging.
Simplification. Try stripping things out of the webview, especially javascript, until you find the piece that's causing the problem.
Implement the WebResourceLoadDelegate methods to see what piece seems to be causing the problem. The information given by this can be misleading, since it has to do with when things are downloaded, not when they are rendered, but it can give a sense of where in the page you're hanging.