Quantcast
Channel: UITableViewCell animate resize when user touchdown or tap Cell - Stack Overflow
Viewing all articles
Browse latest Browse all 5

UITableViewCell animate resize when user touchdown or tap Cell

$
0
0

I want to animate a UITableViewCell like in the following image (The cell gets resized smaller) before detailedViewController is show. I have tried it from last two days and tried other all the answers I found for similar questions.

I want the cell to animate/resize as soon as user put his finger on the UITableViewCell.

enter image description here

The UITableViewCell is a custom cell. I have tried setting a new frame to cell.contentView in UITableViewCell subclass's setSelected:(BOOL)selected animated:(BOOL)animated method. The UITableViewCell didn't resize as I expected.

What I have also observed is this method is called when user lifts his finger up from the UITableViewCell. Actually I want it to happen as soon as user taps the cell. And if the cell is not selected and user moves to some other cell, cell should get resized back to normal size.

Then I did some searching on receiving touch events from UITableViewCell. And I tried to add a UILongPressGestureRecognizer and UITapGestureRecognizer and in the selector I tried to change cell.contentView frame like this

cell.contentView.frame = CGRectMake(cell.frame.origin.x +20, cell.frame.origin.y, cell.frame.size.width-20, cell.frame.size.height);[cell setNeedsDisplay];

But the selected cell is only flashing(cell background) it is not resizing as I expected.

Any suggestions would be really helpful. Thanks in advance


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>