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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:01:30+00:00 2026-06-05T14:01:30+00:00

Inside my viewDidLoad I have the following. But I cannot seem to get the

  • 0

Inside my viewDidLoad I have the following. But I cannot seem to get the syntax right.

[led.highlighted: [[NSUserDefaults standardUserDefaults] boolForKey:@"led"]];

and I also tried

[led.highlighted setValue:[[NSUserDefaults standardUserDefaults] boolForKey:@"led"]];

but that one errors with “Bad Receiver type ‘BOOL'”

My method that sets the value from an IBAction seems to be OK.

[[NSUserDefaults standardUserDefaults] setBool:led.isHighlighted forKey:@"led"];

So how exactly do I return the value of led.highlighted?

  • 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-05T14:01:31+00:00Added an answer on June 5, 2026 at 2:01 pm

    led.highlighted accesses the property; depending on it being on the right- or left-hand side of a statement, it uses the getter or the setter, respectively.

    led.highlighted = YES;
    // Equivalent to: [led setHighlighted:YES];
    BOOL thatLEDIsLitUp = led.highlighted;
    // Equivalent to: BOOL thatLEDIsLitUp = [led highlighted];
    

    This assumes that you haven’t changed the getter and setter names to isHighlighted and setIsHighlighted:

    Given that, to set the property you can do either:

    led.highlighted = [[NSUserDefaults standardUserDefaults] boolForKey:@"led"];
    

    or

    [led setHighlighted:[[NSUserDefaults standardUserDefaults] boolForKey:@"led"]];
    

    Your first attempt, [led.highlighted:...] is just incorrect syntax. The second, [led.highlighted setValue:...] uses the accessor to get highlighted, which is a BOOL, and then tries to send a message to it. BOOLs aren’t objects, so you can’t send messages to them.

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

Sidebar

Related Questions

yeah! i have written the code inside viewDidLoad method but work properly!!! my prolblem
I have the following code inside my @interface FriendsNavController : UINavigationController class implementation. The
Using storyboard ,I created a project. Inside viewDidLoad ,I did : NSLog(@"%@",self.view.description); I got
I am creating a MKMapView in a method named generateMap. From inside viewDidLoad, this
Inside my Controller i have function that runs after user clicks on item, which
Inside my .aspx I have some JSON code that looks like this: function someFunctionName()
Inside Controller I need to get a rendered string and do some actions with
I have a view controller, which creates 2 view controllers inside it. Inside each
I have a UIView that is pushing a UITableViewController that is contained inside of
I have a view which is created in IB. inside it I have a

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.