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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:48:54+00:00 2026-05-11T18:48:54+00:00

Apparently, I’ve been working with bindings too long, because I can’t figure out how

  • 0

Apparently, I’ve been working with bindings too long, because I can’t figure out how to do this. I have a table with several columns. When a row is selected, you can edit its priority, which modifies a core data attribute. I’ve also set this as an IBAction. Basically, I want to access the value of the Core Data attribute from my code. Then, I want to set the first column of whatever row is selected (and had its priority changed) to a number of exclamation marks corresponding to the priority level.

Sorry this is worded confusingly; here’s an example:

Row 7 is selected. I change its priority to 2. Now, the Core Data attribute myPriority is set to 2. A code block is now triggered. It gets the priority of the selected row (row 7) form Core Data and wants to set column 1 of the selected row (row 7) to 2 exclamation marks (priority 2).

Thanks!

  • 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-11T18:48:55+00:00Added an answer on May 11, 2026 at 6:48 pm

    If you’re used to bindings, then I’d recommend looking at NSValueTransformer; specifically, creating a subclass of that which converts a priority value to a string of exclamation marks. You’d then simply provide the name (the same one used in +setValueTransformer:forName:) as the ‘value transformer’ attribute in your bindings.

    For instance, the code would look like so:

    @interface PriorityTransformer : NSValueTransformer
    @end
    
    @implementation PriorityTransformer
    + (Class) transformedValueClass { return ( [NSString class] ); }
    + (BOOL) allowsReverseTransformation { return ( NO ); }
    - (id) transformedValue: (id) value
    {
        // this makes the string creation a bit simpler
        static unichar chars[MAX_PRIORITY_VALUE] = { 0 };
        if ( chars[0] == 0 )
        {
            // ideally you'd use a spinlock or such to ensure it's setup before 
            //  another thread uses it
            int i;
            for ( i = 0; i < MAX_PRIORITY_VALUE; i++ )
                chars[i] = (unichar) '!';
        }
    
        return ( [NSString stringWithCharacters: chars
                                         length: [value unsignedIntegerValue]] );
    }
    @end
    

    You would then put this code into the same file as a central class (such as the application delegate) and register it through that class’s +initialize method to ensure it’s registered in time for any nibs to find it:

    + (void) initialize
    {
        // +initialize is called for each class in a hierarchy, so always
        //  make sure you're being called for your *own* class, not some sub- or
        //  super-class which doesn't have its own implementation of this method
        if ( self != [MyClass class] )
            return;
    
        PriorityTransformer * obj = [[PriorityTransformer alloc] init];
        [NSValueTransformer setValueTransformer: obj forName: @"PriorityTransformer"];
        [obj release];   // obj is retained by the transformer lookup table
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 255k
  • Answers 255k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Here's what I would do: Are you having any issues… May 13, 2026 at 10:19 am
  • Editorial Team
    Editorial Team added an answer I've had the same problem. I don't think there's a… May 13, 2026 at 10:19 am
  • Editorial Team
    Editorial Team added an answer Yes, the generated IL for sealed in C# is identical… May 13, 2026 at 10:19 am

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
Apparently, I've been working with bindings too long, because I can't figure out how
Apparently Java only plays .au audio files and I want to play mp3 files.
Apparently xrange is faster but I have no idea why it's faster (and no
Apparently i need two queries to get the data i need. I cant give

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.