I tried to add picture to my NSView with calling method from another class.
How I must init firstClass instance in secondClass?
Code example:
firstClass.m:
//method for adding picture
-(void) createPoint:(NSPoint)location{
point = [NSImage imageNamed:@"point3"];
point.size = NSMakeSize(21, 21);
pView = [[NSImageView alloc] init];
[pView setFrameSize:crimePoint.size];
[pView setImage:crimePoint];
[pView setFrameOrigin:CGPointMake(location.x-10, location.y-10)];
[self addSubview:pView];
}
secondClass.m:
- (IBAction)updateButton:(id)sender {
[firstC createPoint:NSMakePoint(300, 300)]; // FirstClass* firstC; (alloced and inited)
}
This one looking same, but i don't understand how to use that answer:
Calling Method From Another UIViewController Has No Visible Effect