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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:31:02+00:00 2026-05-17T01:31:02+00:00

Why can’t I observe the editing property of an instance of UITableViewController ? I’m

  • 0

Why can’t I observe the editing property of an instance of UITableViewController?

I’m using the following code:

[self addObserver:self 
       forKeyPath:@"editing" 
          options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
          context:NULL];

And have implemented the method:

- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context

… but the observeValueForKeyPath method is never called when this value changes.


According to Apple’s Ensuring KVC Compliance section:

For properties that are an attribute or a to-one relationship, this requires that your class:

  • Implement a method named -<key>, -is<Key>, or have an instance variable <key> or _<key>.
  • If the property is mutable, then it should also implement -set<Key>:.
  • Your implementation of the -set<Key>: method should not perform validation.
  • Your class should implement -validate<Key>:error: if validation is appropriate for the key.

The documentation for the editing property, states that it is defined as:

@property(nonatomic, getter=isEditing) BOOL editing

Since this property is not mutable, the only bullet point it must conform to is the first one (i.e. that there is an -is<Key> method defined, for example). You can see that it does conform to this by looking at the declaration of the property, and noticing that there is an isEditing method defined. Thus, it should be Key Value Observing compliant. How come it isn’t working?

  • 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-17T01:31:02+00:00Added an answer on May 17, 2026 at 1:31 am

    You’re confusing Key-Value Coding compliance with Key-Value Observing compliance. The property is KVC-compliant, which means you can use [myViewController valueForKey:@"editing"] to access it (if you like typing), but this does not mean it is KVO-compliant.

    KVO-compliance is achieved by the object either implementing a KVC-compliant setter (bullet points 2 and 3), which KVO will wrap automatically, or manually posting KVO notifications by sending itself will/didChangeValueForKey: messages.

    UIViewController and UITableViewController do not publicly implement setEditing:; if they don’t implement it at all, then KVO wrapping it automatically is out. That leaves manual notifications. If you’re not getting any KVO notifications for the property (and you are actually hitting that addObserver:forKeyPath:options:context: message), that suggests that those classes neither privately implement setEditing: nor manually post KVO notifications.

    Therefore, the property is not observable.

    If the only way anything ever sets the editing property is by sending the controller a setEditing:animated: message, then you can override setEditing:animated: and send the KVO notifications yourself from your implementation, and then the property will be observable.

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

Sidebar

Related Questions

Can we close all known/unknown connections to database with the code? I'm using Access
Can somebody help me with this. There is HTML code: <h3> <label> <input type=checkbox
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Can anyone give me an example of how to return the following json simply
Can PHP PDO extension bind nested objects automatically ? I mean using foreign key
Can anybody tell what is the best(easy) way to sort the following string 'index'
can someone explain why the compiler accepts only this code template<typename L, size_t offset,
Can I convert a pdf to pcl file with ghostscript? I'm using Ghostscript 9.01
Can i get the source code for a WAMP stack installer somewhere? Any help
Can anyone tell me how to hide the header in DevExpress gridcontrol..?? I'm using

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.