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

  • Home
  • SEARCH
  • 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 6154685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:18:13+00:00 2026-05-23T20:18:13+00:00

I am pretty new to xcode so forgive my mistakes but I am trying

  • 0

I am pretty new to xcode so forgive my mistakes but I am trying to convert a string into an integer and then create an if statement that makes a button disabled if the value if the integer is less than 15. The integer is stored in a string and I know works correctly because I can display it in a label. I am having trouble converting that string into an integer and then making the button disabled if the score is less than 15. I have no errors, but the code is not working. Here is what I have so far:

- (void)viewDidLoad
{


    NSString *savedValue = [[NSUserDefaults standardUserDefaults]
                            stringForKey:@"levelScore"];


    int level = [savedValue intValue];



    if (level <= 15) {
       levelTwo.enabled = NO;
    }

Any help would be greatly appreciated.

  • 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-23T20:18:14+00:00Added an answer on May 23, 2026 at 8:18 pm
        - (void)viewDidLoad
        {
    
    
            NSString *savedValue = [NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults]
                                    stringForKey:@"levelScore"]];
    
             or
    
            NSString *savedValue = [NSString stringWithFormat:@"%@",[[NSUserDefaults standardUserDefaults]objectForKey:@"levelScore"]];
    
    
    
            int level = [savedValue intValue];
    
    
    
            if (level <= 15) {
                levelTwo.enabled = NO;
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Pretty new (2 weeks) into Objective-C and Xcode, and I'm trying to add my
Pretty new to C# but not new in programming in generally. I'm still trying
im pretty new to xcode, so sorry if these are basics but im having
I'm pretty new to cocoa and Xcode, I've done some basic C coding, but
I'm new to Xcode and I'm trying to create an app which has a
Okay, so I'm pretty new to xcode but I cannot find something specific to
Im pretty new to Java Web Services, but I cant find a good explanation
I'm still pretty new to ObjC. I noticed that it's pretty standard everywhere to
I'm pretty new to PHP, but I decided to try and make a simple
I'm pretty new to Eclipse plugins and I want to create a VerticalRuler, 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.