Multiple images on one page of carousel with event fire - sencha-touch

I need some help with carousel view logic. I want to place 12 images on one page of the carousel. 24 images at all --> 2 carousel pages.
I realy dont know how to realize that. Also want to fire an event if one of those images are tapped by the user. Is this possible?

You should definitely take a look at this tutorial there's pretty much everything you need in it if you're trying to set up an image gallery.
http://superdit.com/2011/08/20/create-image-gallery-using-sencha-touch/
Here's a demo, even though it's not convincing on a big screen :
http://demo.superdit.com/sencha-touch/gallery

Related

How to render just part of the Sprite

I want to make some simple tutorial in my game by showing pop-up animation. My problem occur when moving sprites get out of the tutorialView but keep being rendered. I need to show just those parts that are on the animation view.
I need to hide the white "path" which goes out of the tutorial view
This is what happens
It was actually very easy just took screenshot of the screen and cropped the middle so that I could put it in front of the tutorial and everything that went out of it was hidden underneath.

UIWebView inside full screen UICollectionView with paging

I want to have a full screen UICollectionView with paging, with a UIWebView in every cell.
The WebView should scroll up and down, and the CollectionView should move pages left and right.
Also, I want the pages on the cells will preload so when the user move to a certain page the html page will already be there.
What is the correct way to handle this?
It's hard to put it all in here, so check out if this project gets you closer to solving your problem.
Notice that there is no preloading, because if you'll write your own html and there won't be any network calls, you don't need to preload pages - changes will be instantly visible to your users.
You always gonna have to reload the UIWebView in UICollectionViewCells because they are reusable, but if you want you can make a hack, an UICollectionView that it is 3 times bigger than the frame of your main view it has to begin in the second page and finish in the one before the last.
It is going to have always 3 webviews preloaded (but you can make the hack bigger if you want) or you can make a UIScrollView with pagination activated which always gonna have all of the webview preloaded.

Can I maintain smooth scrolling when loading HTML into child UIWebView?

I need to show a paginated slideshow of moderately DOM-intensive HTML pages in an iPad application.
All documents are tailored for iPad screen so there is never any scrolling inside UIWebViews.
I decided to put UIWebViews inside UIScrollView for pagination.
It works really well and smooth after all web views have rendered their content.
However, I can't afford waiting for 20, 30 or 50 web views to load before user can scroll: it takes minutes.
I tried to anticipate swipes in scrollViewDidScroll handler and pre-load a few next pages as user keep scrolling.
This worked much better (no performance difference between 10 or 150 web views).
However calling loadHTMLString in scrollViewDidScroll handler causes scrolling to lose it smoothness.
I don't care if it takes a second longer to show a particular UIWebView—all I want is for scrolling to be smooth and available as soon as possible, and to lazily preload UIWebViews on the go.
How do I achieve that?
This is a difficult problem and there is no easy/elegant way to solve it.
One way to speed up the scroll would be to lazy load the pages as you stated in your question. However, in order to ensure smoothness you would have to control when the loading happens.
So say you began by loading the first 5 pages on initial launch. When the user scrolls to page 2 and STOPS, you begin loading page 6. As soon as the user starts scrolling again you pause the loading only to resume when they have stopped on a new page. Pausing the loading in between will help smooth out the scrolling. Also, make sure you release data when possible because it can build up and hinder smooth scrolling down the line.
Another option would be to have the UIWebViews begin loading only as soon as the user stops on the page. So say I scroll to page to, once the scrolling stops I begin to load the HTML. This is not as "pretty" as the first options but it will ensure that the scrolling is smooth.
Another option, this one is a bit out there, is to run through and load all the HTML pages rich text. Leaving out all the DOM intensive stuff. Then grab a screen shot of those semi-loaded page using this method. When the user stops on the page you load it all the way including the DOM intensive stuff. This will let the user feel as thought they are scrolling quick with everything loaded.
Here is a great scrolling class that I have used before.
Here is some code to help with method 3.
Good luck and I hope that this helps!
EDIT:
Here is a great post from the guys at LinkedIn on how they solved webView scrolling problems. It would be worth a read.

UIWebView: how to hide part of the content of a webpage?

In my app I have a webview that is used solely for displaying the facebook page.
However, the client does not want the top blue bar of facebook to appear; he wants to hide it.
Is there a way to do this?
The bar is 45 pixels, so what I did is I moved the UIWebView in IB in such a way that its top 45 pixels are behind my navigation bar (thus not appearing).
However, this is not an ideal solution, as the user can see that content when he scrolls up, before bouncing. He can see but not touch it, which will be frustrating for some users.
I tried turning the bouncing off, but then the UI becomes too rigid, and not fluid.
I looked up in Google and Stackoverflow for a couple of hours but didn`t find a solution.
Thanks a lot!
You'll have to edit the HTML/CSS of the page itself to hide the HTML elements in question, probably using regular expressions, and feed it into your UIWebView with loadHTMLString:baseURL:.
I've done similar manipulating before and it works, but... it's a different ballgame when the webpages in question don't belong to you. Any time Facebook updates their layout, your app behavior might change until you have time to get an app update approved. Clients want what they want, but make sure your client knows what he's asking for!
First test out the javascript code used to hide whatever elements in the webpage and then pass up to stringByEvaluatingJavaScriptFromString of UIWebView to run it.

Transition between multiple views

In my app I want to show multiple views one after another to show multiple values when the user slides his finger on the screen, just like photo album. I want the same animation. Can anyone explain how I can achieve this?
You can store the images in an array... By using the UISwipeGestureRecognizer you can able to do the photo album.... if you have any doubt communicate with me...
I suggest looking at one of the WWDC 2010 sessions, I believe it was called "Designing apps with scroll views", it basically builds the exact thing your looking for with UIScrollViews. Take a look at the video and the sample code - https://developer.apple.com/videos/wwdc/2010/?id=104 and the sample code should be here http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?code=y&source=x&bundleID=20645
PS! You have to be a iPhone Developer to access this content.