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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:30:09+00:00 2026-06-02T20:30:09+00:00

Using accessors seems to be the way to get KVO notifications on collection objects,

  • 0

Using accessors seems to be the way to get KVO notifications on collection objects, but this doesn’t appear to work on the childViewControllers NSArray property of a UIViewController. I want to be notified when an object is added or removed to this property. So I tried this:

[self addObserver:self forKeyPath:@"childViewControllers" options:NSKeyValueObservingOptionNew context:nil];

-(NSUInteger)countOfChildViewControllers
{
    return self.childViewControllers.count;
}

But I’m not sure if I’m doing it right, I’m not getting any notifications. Is what I want possible?

  • 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-02T20:30:10+00:00Added an answer on June 2, 2026 at 8:30 pm

    The point is that all modifications of the property have to go through KVO-compliant means. This has to do with how UIViewController is implemented, nothing you can do from outside of that class. Using the indexed collection accessors is one way that the implementation of UIViewController could achieve KVO-compliance, but there are others. I don’t know if that property is KVO-compliant; from what you report, apparently not. Adding getters or even setters in a category or subclass doesn’t help if the underlying implementation doesn’t use them.

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

Sidebar

Related Questions

On the face of it, this seems a very simple problem but for some
I have heard that in C++, using an accessor ( get...() ) in a
I'm using ROXML to read and automatically build Ruby objects form properly formatted XML.
I'm using OCMock to mock some Core Data objects. Previously, I had the properties
I realize this is a pretty open question and could get a variety of
Using table creation as normal: t = Table(name, meta, [columns ...]) This is the
I'm using loadonce to get all data up front and then doing sorting and
My program basically looks like this: using(XmlReader reader = XmlReader.Create(File.Open(path, FileMode.Open, FileAccess.Reader, FileShare.Read)) {
This is hard to explain, but I will do my best: I am building
I'm using dynamic attr_accessible as per this article: http://asciicasts.com/episodes/237-dynamic-attr-accessible It works fine. But 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.