Animate TableView Cell to swipe left - ios

I would like to make a simple animation in the first cell of a table view to indicate that the user can delete this cell!
I have already completed the delete feature of the cell, etc.
How is it possible to achieve this like a bounce animation?
Facebook has already done that if you go to the notifications for the very first time you go to that view.

1) You can take one view inside cell. Design it whatever way you like.
2) Set it frames like it want be visible on screen while designing.
3) To adding animation effect, you can use default UIView animation or you can refer UIKit dynamics to achieve spring and bouns effect.
4) Set view frames progamatically to come from right to left.
4) Rest of the logic to display only one time, you can write it by yourselef :-)

Related

Hiding Specific Views When SearchBar Text Did Change

As newbie, I finally got a case project for internship. Before jump in directly to code, I would like to ask about a logic.
here how it is look like
As you can as see, I have a search bar in the top, and under that a page view and under that a collectionview. So I will display to first 3 data in pageview and rest of it will be displayed in collectionView. Whenever user start typing in searchbar, PageView must disappear and collectionview must go all the way to the top. (under searchbar) And collectionview must display the filtered data. Once user delete all text from search bar, everything should be like in the beginning and pageview must be in the same page before user typed in searchbar. (If it was in the 2. page, it must be in the 2.page after its displayed again)
Problem is with hiding pageview when searchbar is used. My idea is the create ui programmaticly and once textDidChange func of searchBar runs, hide pageView and change constraints of collectionview programmatically. Once text is nil, make pageview visible again and change constraints again.
Is this logic useful? Is there any better way to do it?
Your approach seems correct to me, that's how I'd do it as well.
To add an extra touch, you can also animate the layout constraints changes (by calling layoutIfNeeded in the animation block, look up "animate constraints" on StackOverflow).
And for a perfect user experience, make those animations reversible by using UIViewPropertyAnimator so that if the user typed a letter and then quickly erased it during the animation it would just reverse in the middle. It's a somewhat advanced technique but you'll gain a great deal of experience with animations by implementing it. Watch Advanced Animations with UIKit from WWDC17 for more details.

Move a button from one UITableViewCell to another with animation in Swift

I have a button and I want to keep track of which cell has the button with firebase. I can do this by putting the button in all cells and just make it visible in the one cell using firebase data. The part I'm stuck on is animating the button to move from one cell to another.
The only way I can think of is to put a delay on moving it from one to another, then have a separate animation happen. Then I think if I make the delay the same as the animation's duration then it will look like it just moved. I just thought of that while typing this but let me know if there's an easier/better way please!
This is a pretty tough thing to do, and animations can sometimes be one of the most difficult parts of mobile development. You aren't super clear on what your animation should look like, but since UITableViewCells each have their own contentViews I don't think directly animating the button from one cell to another is possible.
The best method I could think is to:
1) Draw a button on the screen at the location of the button you want to move
2) Hide the real button underneath
3) Animate this fake button over the tableview to the spot of the new, real button
4) End the animation and show the real button.
But you might have to block user interaction with the tableview while this happens to prevent them from scrolling and screwing up the animation...

Putting Text into horizontally UIScrollView and appropriate AutoLayout - Swift

So I want to create a Slider on the top of the UI, each item representing a Category (there will be five items). I don't want to switch to another Controller, when sliding to another Category, I just want to load new data into the current controller. So I guess the UIScrollView is the way to go.
See here for what I want to realize:
I have trouble now to show the name of the chosen Category in the middle of the Slider, and by the same time on the left and right its neighbors.
Using a effective AutoLayout is a also necessary.
Is putting Panels into the UIScrollView the right way?
I am new to iOS-Development and would appreciate any help.
Add a scrollview to the top of your controller, in code configure scrollcontentwidth to screenWidth*5 and on each swipe change reload the data of your controller.

iOS UI - App Store Explore section Transition

I was wondering if this nice master-detail transition where you click on the tableView cell and it expand to disclose the detail , with the cell's label being the navigation bar title is an interface which is part of the SDK object library or it is a customised one?
This is a custom transition between ViewControllers.
There's a nice example of a few transitions (including this one) in this library.
Of course you'll need to add the tableview etc' but this is a great place to start.
I've tried few things but so far this is the best option I could think of.
Animating the frames of all the visible cells and making use of childViewController is how I achieved it.
Animation test project
https://github.com/armaluca/iOS-App-Store-Explore-Section-Animation
Would be nice to know any other possible solution and ultimately to know how Apple did it!
It is custom implementation.There is no API in UIKit/UITableView which implements this behaviour. Only animation to present a cell is there(which I think is used here).
This behaviour can be implemented like-
Add sections(News, Productivity, etc) in table with zero cells(numberOfRowsInSection: = 0 for all sections). Then on tapping any section just reload that section(reloadSections:withRowAnimation:) by adding a cell to it(numberOfRowsInSection: = 1) and animation(maybe UITableViewRowAnimationMiddle). Scroll that section/row to top in same animation loop(UI update cycle).

how to drag or drop multi uitableveiwcells on ios?

I want do drag a lot of selected cells and recorder them in my app.But I don't know how to do it.It seems apple just let u to drag one that what I have done it.
idea?
If it is ok to require that the selected cells are contiguous, then you can cheat by replacing them with a single tall cell.
EDIT:
For noncontiguous, the lazy solution would be to let the user select any cells, then after they drag and drop one of them, just move all the other selected cells right below it.
You could experiment with UITableView and see if it will let you animate out the other selected cells (with deleteRowsAtIndexPaths:withRowAnimation:) as soon as dragging is detected (possibly with UITableViewDelegate's tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:). You could also see if it will let you redraw/resize the cell when it begins dragging - then you could make it look like a z-layered stack or totem pole them into a tall cell while dragging.
Of course I'm assuming all the selected cells will share the same destination position. I can't wrap my head around noncontiguous sources to noncontiguous destinations in one drag-n-drop. If the user drags down 3 slots, does that mean you add 3 to the positions of all the selected cells? What if that takes a cell out of bounds? Even if you decided on some rules for odd cases like those and actually implemented this monstrosity, it could never be user friendly.
There is no easy way out. You need to handle the animation and movement by yourself.
Maybe you can take a copy of the cells you want to move and show an animation of moving to the destination.
When animation stops change the datasource.

Resources