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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:03:20+00:00 2026-05-30T13:03:20+00:00

I am performing the Pythagorean theorem, and every time you click the calculate button,

  • 0

I am performing the Pythagorean theorem, and every time you click the “calculate” button, it refreshes my UITextField with the answer. And yes, it is a text field, not a label. For some reason, it only refreshes once, and that is the first time I try it. I tried setting it to nil first, but that didn’t work. Here is my function called when you press the button (After some debugging, I found it only is getting called once):

-(IBAction) calculate: (id) sender
{
    ansNum = (fabsf(fy * fy)) + (fabsf(fx * fx));
    ansNum = sqrtf(ansNum);

    [fField setText:[NSString stringWithFormat:@"%g",ansNum]];
}
  • 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-30T13:03:21+00:00Added an answer on May 30, 2026 at 1:03 pm

    So your calculate function is being ran when the relevant event triggers it, but running it again yields no results? Are either fx or fy changing so that different results should be present?

    You could try put some debug statements in to try and work out what is going wrong, e.g.

    - (IBAction)calculate: (id)sender
    {
        ansNum = (fabsf(fy * fy)) + (fabsf(fx * fx));
        ansNum = sqrtf(ansNum);
    
        [fField setText:[NSString stringWithFormat:@"%g",ansNum]];
    
        NSLog(@"%f, %f, %@", fx, fy, fField);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After performing processing I want to calculate the percentage of white pixels between this
When performing some custom painting on a button's Graphics2D object, I get the following
When performing some action on another user's repo, you will see the message Not
When performing http compression is there low threshold where it is recommended to not
When performing string concatentation of an existing string in the intern pool, is a
When performing many disk operations, does multithreading help, hinder, or make no difference? For
While performing a conditional DELETE operation in one of my InnoDB tables, which apparently
While performing some upcoming maintenance, I'm going to have to redirect all site traffic
When performing many inserts into a database I would usually have code like this:
I am performing two validations on the client side on the samve event. I

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.