title: Objective c change autosizing of NSRect in custom view
body: <p>The title is fairly specific about what I want to do. I have a custom view and have drawn some elements inside that view. How do I change the autosizing properties programmtically? I have looked around and couldn't find anything that would help me in my case.</p>
  
  <p>Objective C:</p>
  
  <pre><code>- (void)drawRect:(NSRect)HTMLContent { 
      NSGraphicsContext* gc = [NSGraphicsContext currentContext];
      [gc saveGraphicsState];
      int height = [[NSScreen mainScreen] frame].size.height;
      int screenwidth = [[NSScreen mainScreen] frame].size.width;
      int emailInnerContentWidth = screenwidth - 510;
  
      // Horizontal Line
      [[NSColor colorWithCalibratedRed:.8 green:.82 blue:.83 alpha:1] setFill];
      NSBezierPath* drawingPath = [NSBezierPath bezierPathWithRect:NSMakeRect(337, 570, emailInnerContentWidth, 2)];
      [drawingPath fill];
  
      // Social Icon
      NSRect outrect = NSMakeRect(355, 585, 58, 58);
      [[NSColor lightGrayColor] setStroke];
      [[NSColor colorWithPatternImage:[NSImage imageNamed:@"NoSocialIcon.png"]] setFill];
      NSBezierPath* outcirclePath = [NSBezierPath bezierPath];
      [outcirclePath appendBezierPathWithOvalInRect: outrect];
      [[NSColor lightGrayColor] setStroke];[[NSImage imageNamed:@"NoSocialIcon.png"] drawInRect:outrect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1];
      [outcirclePath stroke];
  
      // Restore graphics state
      [gc restoreGraphicsState];
  }
  </code></pre>
  
  <p>I want to set these 2 shapes to not be affected by the bottom of the window changing. I want it to change when the top of the window changes height. I have looked on the Apple docs and nothing seemed to work. Thanks in advance</p>