objective-cnsviewnswindownspoint

How to get each NSPoint from NSView, subview on NSWindow?


I have mac application, I want to display sheet from particular nspoint, I have multiple views with hierarchy, So, I want selected nspoint on (upper level view i.e. sub view of sun view)view, get it in nswindow & present sheet from that point in objective c. How to achieve this?


Solution

  • I got answer : just in upper sub view or any subview in window -> NSPoint point = [self.window.contentView convertPoint:[NSApp currentEvent].locationInWindow fromView:nil]; get mouse clicked point on view.

    Post notification from this subview with value of this point , listen notification in its parent window, get same point value. save it.

    & in window - use this point to to present sheet, use - willPositionSheet:this method to change presented sheet's frame.