0

This is what i am doing

  1. Create a new 10.9 cocoa application
  2. Drag a drop a custom view to the top right corner - by leaving the default size of the custom view
  3. In Appdelegate.h i create this line by cmd+drag -> @property (weak) IBOutlet NSView *myView;
  4. In Appdelegate.m i synthesize like -> @synthesize myView;

Then i add this code

- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
    // Insert code here to initialize your application

    [myView setWantsLayer:YES];
    myView.layer.backgroundColor = CGColorCreateGenericRGB(0,0,0,0.5);


    NSRect vFrame = myView.frame;

    vFrame.origin.x = 0;
    vFrame.origin.y = 0;

    vFrame.size.width = 100;
    vFrame.size.height = 100;

    [myView setFrame:vFrame];


}

The question i have is - whenever i resize my window the myView (my NSView) switches to to it original position and size. All i want it it should not change it's origin or size even if i resize

user226372
  • 165
  • 1
  • 9

0 Answers0