title: Adding a UIView class outside ViewController class to show subview
body: <p>I have been check many close answers here, no one can solve my stupid problem..</p>
  
  <p>My problem is: I have 2 classes, UIViewController classA and UIView classB.</p>
  
  <p>A button(classA) trigger to process(classB), then show the subview on screen(classA).
  But it doesn't work. </p>
  
  <p>classA .m:</p>
  
  <pre><code>@implementation ViewController
  ...
  
  - (IBAction)trigger:(UIButton *)sender {
      [classB  makeViewOn];
  }
  </code></pre>
  
  <p>classB .h:</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface classB : UIView
  + (void)makeViewOn;
  
  @end
  </code></pre>
  
  <p>classB .m:</p>
  
  <pre><code>#import "classB.h"
  
  #import "ViewController.h"
  
  @implementation classB
  
  + (void)makeViewOn
  {        
      ViewController *pointer = [ViewController new];
      UIWindow *window = pointer.view.window;
  
      classB *overlayView = [[classB alloc] initWithFrame:window.bounds];
      overlayView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5f];
      overlayView.userInteractionEnabled = YES;
  
      [pointer.view addSubview:overlayView];
  }
  
  @end
  </code></pre>
  
  <p>If I do this in only one class, UIViewController, it works fine; However, if I do this on two separate class(UIViewController &amp; UIView), how can I fix it?</p>
  
  <p>Am I doing something wrong on basic concepts of communicating between classes?</p>
  
  <p>Thanks a lot!</p>