Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8440643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:20:44+00:00 2026-06-10T08:20:44+00:00

In my UITableViewCell I have UIImageView which i want to rotate for 180° every

  • 0

In my UITableViewCell I have UIImageView which i want to rotate for 180° every time user clicks the row (didSelectRowAtIndexPath:). Code is pretty simple :

- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 {
     UITableViewCell *curCell = [self.tableView cellForRowAtIndexPath:indexPath];
     UIImageView *imgArrow = (UIImageView*)[curCell viewWithTag:3];
     [UIView animateWithDuration:0.3 animations:^{imgArrow.transform = CGAffineTransformMakeRotation(M_PI);}];
 }

The problem is that this always happens only once – the first time user clicks cell, imgArrow is rotated properly, but it wont rotate back when cell is clicked for second time. why?

Thanks for help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T08:20:45+00:00Added an answer on June 10, 2026 at 8:20 am

    The problem is that the views transform property rotates to the degree specified from the views original transform. So Once your button is rotated 180 degrees calling this again will do nothing because it will attempt to rotate from where it currently is (180) to 180.

    This being said, you need to make an if statement to check the transform. If it is 180 set the rotating to “0” and vice versa.

    An easy way to achieve this would be using a BOOL.

    if (shouldRotate){
         [UIView animateWithDuration:0.3 animations:^{imgArrow.transform = CGAffineTransformMakeRotation(M_PI);}];
         shouldRotate = NO;
    }else{
         [UIView animateWithDuration:0.3 animations:^{imgArrow.transform = CGAffineTransformMakeRotation(0);}];
         shouldRotate = YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a UITableViewCell nib file in which there is a UIImageView and a
I created a UITableViewCell in Interface Builder which I have added a UIImageView and
I have a UITableView. I place an UIImageView on each row UITableViewCell. I used
I would want to create a custom UITableViewCell which should have a different appearance
I have a custom UITableViewCell with four UIImageView inside it. I want to detect
I have an UIImageView in my UITableViewCell which is not being displayed. I get
I have a UITableViewCell subclass which draws a rectangular vertical line of 5px width
I've an application in which each row contains an uiimageview and an uibutton. I
I have custom UITableViewCell and UIImageView in it. I need to switch the content
I have a custom UITableViewCell that consists of a UIImageView and a UILabel. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.