title: an objective-c category in same file exposed to outside world
body: <p>I have seen a class which implements a catagory on itself. The code is as follow:</p>
  
  <p>.h file:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  @interface BPTopTabBarViewController : UIViewController
  
  @end
  
  @interface UIViewController (BPTopTabBarViewController)
  @property (nonatomic, readonly) BPTopTabBarViewController *topTabBarViewController;
  @end
  </code></pre>
  
  <p>.m file:</p>
  
  <pre><code>#import "BPTopTabBarViewController.h"
  #import &lt;objc/runtime.h&gt;
  @implementation UIViewController (BPTopTabBarViewController)
  - (BPTopTabBarViewController *)topTabBarViewController
  {
      return objc_getAssociatedObject(self, BPTopTabBarViewControllerKey);
  }
  
  - (void)setTopTabBarViewController:(BPTopTabBarViewController *)topTabBarViewController
  {
      objc_setAssociatedObject(self, BPTopTabBarViewControllerKey, topTabBarViewController, OBJC_ASSOCIATION_ASSIGN);
  }
  @end
  
  @interface BPTopTabBarViewController () {
  }
  
  @end
  
  @implementation BPTopTabBarViewController
  ...
  @end
  </code></pre>
  
  <p>My Questions are:</p>
  
  <ol>
  <li><p>What is the point of introducing a getter and setter on itself with a category of UIViewController? According to me only the class of BPTopTabBarViewController or the subclass of it can see the category because there is no category header(#import "UIViewController + BPTopTabBarViewController") declared in .h file. </p></li>
  <li><p>I can see UINavigationController also have some structure like this: </p>
  
  <p>@interface UIViewController (UINavigationControllerItem)</p></li>
  </ol>
  
  <p>Here we can always call a class of UIViewController or its subclass self.navigationController, how is the category exposed to UIViewController when it is written in UINavigationController class?
  I also don't see the category header in UINavigationController.h file:</p>
  
  <pre><code>//  Copyright (c) 2007-2014 Apple Inc. All rights reserved.
  //
  
  #import &lt;Foundation/Foundation.h&gt;
  #import &lt;CoreGraphics/CoreGraphics.h&gt;
  #import &lt;UIKit/UIViewController.h&gt;
  #import &lt;UIKit/UIKitDefines.h&gt;
  #import &lt;UIKit/UIInterface.h&gt;
  #import &lt;UIKit/UIGeometry.h&gt;
  #import &lt;UIKit/UIPanGestureRecognizer.h&gt;
  #import &lt;UIKit/UITapGestureRecognizer.h&gt;
  </code></pre>
  
  <ol start="3">
  <li><p>If I want to expose the category to specific UIViewController class, what should I do?</p></li>
  <li><p>If I want to expose the category globally, should I put #import "BPTopTabBarViewController.h" into project-Prefix.pch file?</p></li>
  </ol>