I am using IKImageView for the functionalities of Image.
- (IBAction)switchToolMode: (id)sender
{
// switch the tool mode...
NSInteger newTool;
if ([sender isKindOfClass: [NSSegmentedControl class]])
newTool = [sender selectedSegment];
else
newTool = [sender tag];
switch (newTool)
{
case 0:
[_imageView setCurrentToolMode: IKToolModeMove];
break;
case 1:
[_imageView setCurrentToolMode: IKToolModeSelect];
break;
case 2:
[_imageView setCurrentToolMode: IKToolModeCrop];
break;
case 3:
[_imageView setCurrentToolMode: IKToolModeRotate];
break;
case 4:
[_imageView setCurrentToolMode: IKToolModeAnnotate];
break;
}
}
After the [_imageView setCurrentToolMode: IKToolModeAnnotate];
called i need to get the current mouse position (After drawing the shape). IKToolModeAnnotate
is default function so i am not able to find where the control goes next.
Can anybody solve my problem.
From
NSApplication
you always can get the last respectively current event by calling[NSApp currentEvent]
. From that you can extract the mouse location.Alternatively you get the location via
[NSWindow mouseLocationOutsideOfEventStream]
. I recommend to read up onNSEvent
so you know the differences between these locations, which is the coordinate system used for the point. See also NSEvent documentation .