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 3403730
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:17:47+00:00 2026-05-18T05:17:47+00:00

Hi so this is my situation up to now. I’ve added a UIImageView to

  • 0

Hi so this is my situation up to now. I’ve added a UIImageView to Interface Builder and set it to a .png image of a needle (Needle.png), I’ve also connected it to the corresponding IBOutlet in Xcode.

In my viewDidLoad: method I set the anchor point,

- (void)viewDidLoad {
    [super viewDidLoad];

    [needle.layer  setAnchorPoint:CGPointMake( 0.5, 1 )];
}

And I’ve also created a button in Interface Builder and connected it to an IBAction in Xcode, this button performs an animation block,

- (IBAction)animate {

 [UIView beginAnimations:@"rotate" context:nil];
 [UIView setAnimationDuration:1.0];
 self.needle.transform = CGAffineTransformMakeRotation(10 * M_PI / 180);
 [UIView commitAnimations];

}

So when I press the animate button my needle image rotates by 10° counter-clockwise, so thats a start. But what I really want to do it to have the needle constantly rotating itself to the correct angle based off a constantly changing value.

For example if I have a decibel value that gives me the current decibel level in the room, I’d like that needle to reflect that value (i.e. 10° == 10dB), and since this value is constantly changing I’d want my needle to rotate clockwise or counter-clockwise accordingly.

Does anyone know how I could do that? I’d also appreciate it if someone could post some source code to help me out.

  • 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-05-18T05:17:48+00:00Added an answer on May 18, 2026 at 5:17 am

    But what I really want to do it to
    have the needle constantly rotating
    itself to the correct angle based off
    a constantly changing value.

    Change the rotation value when the “constantly changing value” changes.

    What is the stimulus to the change of this value? Place the code to change the rotation there.

    If the value is a KVO – you could use that mechanism to change the rotation when the KVO changes.

    Also – sounds like you may want to do the change in an animation block, to make the needle movements more fluid. Say for example the value only changes once a second – make the change in an animation block that makes it change over the course of a second. They movement of the needle will be less “jerky” that way.

    Be forewarned that if you are doing animation, set the setAnimationBeginsFromCurrentState – so if you change values (and re-animate) halfway through an existing animation, it will “do the right thing”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried endlessly now you resolve this utter frustrating situation I have been having.
I have this situation: interface MessageListener { void onMessageReceipt(Message message); } class MessageReceiver {
I have this situation that is really irritating me now. At random times with
I ran into this bizarre pointer-less situation in my code and am now wondering
I have been dealing with this situation for a while now. I have been
I have been working on and off with Java/Python. Now in this situation I
I have worked with various applications and encountered this situation many times. Until now
In this situation I have two models, Comment and Score. The relationship is defined
I have this situation: $(#button).toggle(function(){ $(#window).animate({top:'0%'},1000); },function(){ $(#window).animate({top:'-100%'},1000); }); but I need change it
I have this situation: http://jsfiddle.net/bRDgK/3/ In this situation I have a modal dialog with

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.