Custom UITableView Animation - iphone

Is it possible to change the scrolling on a UITableView? Such as the following?
http://dribbble.com/shots/1176252-Events-iOS7?list=users
In this example, the cells have an accordion effect to them. It's like when the user drags a cell from the top of the page down the ones underneath the dragged location pinch into it, and the ones above it pull away.
I feel like I could do this if I were just use UIView's as cells and custom animate them but I believe that I would be wasting so much making a ton of UIViews.
Any tips, or direction would be so helpful. Thanks!

Related

Vertical and horizontal scoll at a time in gridview with infinite scrolling IOS

How can one enable horizontal and vertical scrolling at same time in a grid view?
If I have a 4x4 grid of thumbnail images, I want to implement swiping in both directions, left/right and top/bottom. Currently I am done with left and right swipe, but if I select the second cell and swipe towards the top, the 2nd row should be scrolled like a Rubik's cube.
Please share if any one have any idea.
It's been quite a while since your question but as I've been struggling with the same thing I'm gonna answer it for future reference...
Sadly I could not find a good solution anywhere so after a lot of hours of experimenting I came up with this: https://github.com/AlvinNutbeij/DWGridController
It's still a work in progress but very usable for your purpose I'd say!
How have you currently implemented what you have? Your mention of 'cell' makes it sound like you are using a UITableView. You won't manage to make one of those scroll in both directions, you'll need to work with a UIScrollView.
I suggest you watch "Designing apps with Scroll Views" from WWDC 2010, then "Advanced Scrollview Techniques" from WWDC 2011. That'll teach you about how you implement tiling and infinite scrolling.
Essentially what you want to do is implement some kind of view recycling yourself, that works like the way UITableView recycles its cells. When things are scrolled off one side of the scroll view, you remove the views for the things that just scrolled off screen and put them in a queue. When things scroll onto the screen, you pull views out of the queue (or create new ones if the queue is empty) and lay those views out in the correct place.
To do the infinite scrolling, you fake it: when your scroll view gets near its edge, you reposition everything inside it, you move the scroll view's content offset to where you've repositioned the views, and then you continue from there: it's all done at once so the user never notices.
The videos will explain these techniques better than I can sum up here: watch those as your first point of call.

Better to use UIScrollView or UITableView for horizontal buttons?

I have a page enabled scrollview on an iPad. On the first page, I have a child scrollview that scrolls horizontally through image buttons. The buttons scroll the outer scroll view to the correct page. Its basically like a table of contents that jumps to the correct page.
My end goal is to be able to categorize the buttons seen in the child scroll view. So there would be a segmented control that changes what buttons you can see. So maybe one category would be ALL, and another category would be A-M, and another would be N-Z for example.
My question is, should I use a uiscrollview or a uitableview?
Right now I use a scrollview and it is really easy to get the buttons in. I could implement the different categories kind of gimmicky by having all of the buttons in the scrollview and then just showing or hiding the buttons accordingly. I feel that it'd be bad memory usage though.
For a uiscrollview i was looking at using EasyTableView, butI'm not 100% sure if this is compatible with what i want to do or if it'd even be better.
Any ideas for what the best way to implement this is? Specifically, I'm not sure of the best way to change the buttons when I change categories.
Thanks!
Use a tableview when you are dealing with data that is best expressed as sections and rows.
I think for your situation I'd have a UIView subclass that can display the images you need for a given category. Stick that on the outer scrollview as needed. You can keep memory low by only keeping the currently visible view and the ones on either side on the scrollview. When you scroll to a new location you can recreate the view needed for that page, and the ones surrounding it. Then you release the ones that are far away and let the system reclaim their memory if needed.

Recreate UIPickerView with just one row showing

I need a "PickerView", that behaves like a normal UIPickerView, but only shows one row of data and has a custom design.
Something like you see in the image, showing the transition from subview 1 to subview 2. After the user lifts his finger and after the scrolling stops, only one subview will be shown:
IMAGE
So basically a scrollview which:
is endless in both, positive and negative directions by showing the same entries over and over
uses paging across several subviews
only shows one subview when not scrolling, and no more than two subviews when scrolling.
I can get a endless scrollview to work, but not with paging enabled. Paging will always limit my scrolling to the next subview.
So I'm thinking about creating my own UIView subclass which custom scrolling behaviour to mimic a UIPickerView. But before doing so, I wanted to get some opinions about the idea in general. Is creating a custom UIView the right way to go? Anyone has some experience with the expected performace? (There will be timers to handle the scrolling algorithm, which has to be recreated of course... :)
Another approach would be to subclass UIScrolView and implement the paging myself. I know when the scrollView starts decelerating
, so maybe there is a way to overwrite the contentOffset to have it scroll into the right position...?!
Any help is appreciated! Thanks!
Here is a great custom component, which seems to be able to do everything you need:
http://dev.doukasd.com/2011/04/infinite-scrolling-dial-control-for-ios/
It's not endless, but rather a modified UITableView with a huge number of cells.
Would it be feasible to just use a UIPickerView, but clipped to the middle row? You could turn off showsSelectionIndicator to remove the overlay and have the delegate pass back custom row views.

iPhone: scroll view with arbitrary page/"settling" boundaries?

I'm trying to figure out if I can get what I want out of UIScrollView through some trickery or whether I need to roll my own scroll view:
I have a series of items in row that I want to scroll through. One item should always be centered in the view, but other items should be visible to either side. In other words, I want normal scrolling and edge bouncing, but I want the deceleration when the user ends a touch to naturally settle at some specified stop point. (Actually now that I think of it, this behavior is similar to coverflow in this respect.)
I know UIScrollView doesn't do this out of the box, but does anyone have suggestions for how it might be made to do this, or if anyone's spotted any code that accomplishes something similar (I'm loathe to reimplement all the math for deceleration and edge bounce)
Thanks!
There is not a whole lot of trickery to this. Just use an UIScrollView with paging enabled. Make it the size of one of your items, and locate it where you want that item to appear. Next, disable the "Clip Subviews" option on the scroll view (either in IB, or programmatically), and you are all set.

How to control scrolling sound of uipicker?

How to control scrolling sound of uipicker? Any available sample code?
There is no documented way. That being said:
[myPickerView setSoundsEnabled:NO];
Like Peter said, there's no public way to do this. However, if it's really critical you could implement your own picker-type object. Basically, all you need to do is create a UITableView and customize the cells as you like. Then create an image to add as a UIImageView subview that's the same size as the table. At its simplest, all you need is a little bit of gradient fade-to-black at the top and bottom so the cells of the table appear to fade in/out. You could also add a bit of a frame around the table, or anything else really, as you like.
If you take a look at a picker and think of the wheels as just UITableViews with a gradient at the top and bottom, you'll see that the curved effect is just that simple. If you look closely as you scroll the cells offscreen, you can see that they never change shape; they just fade out.
As for the sounds, you could then use any of the UIScrollViewDelegate and UITableViewDelegate methods to monitor when the "wheel" moves and check to see where the table cells are on-screen. Perhaps when a cell passes the mid-way point, you play your custom sound.
It would definitely take a little bit of work to implement this, but is certainly possible if it's critical for your app.