I have this situation:
I have a NSView which contains a custom NSImageView.
I’m trying to move the NSImageView from the view controller, but no success so far.
This is the header of the view controller:
#import <Cocoa/Cocoa.h>
#include "MyAppDragAndDropImageView.h"
@interface MyAppViewController : NSViewController <MyAppDragAndDropImageViewDelegate>
@property (nonatomic,assign) IBOutlet MyAppDragAndDropImageView *dragAndDropImageView;
@property (nonatomic,assign) IBOutlet NSTextField *workingFileLabel;
@property (nonatomic,assign) IBOutlet NSTextField *workingFileSizeLabel;
@property (nonatomic,assign) IBOutlet NSButton *clearButton;
-(IBAction)onClearButtonClicked:(id)sender;
All IBOutlets have been connected from the Interface Builder.
I’m using this code inside the view controller to move the custom NSImageView…
-(void)awakeFromNib
{
//dragAndDropImageView frame
NSRect ddivFrame = [dragAndDropImageView frame];
ddivFrame.origin.x = SOME_NUMBER;
ddivFrame.origin.y = SOME_NUMBER;
[dragAndDropImageView setFrame:ddivFrame];
[dragAndDropImageView setNeedsDisplay:YES];
}
…But nothing happens!
Using NSLog I’ve found that the frame “x” and “y” have been updated, but it is displayed in the old position! Any clues?
Thanks
Why not set them as hidden/
alphaValueto0in the nib, and then have your NSViewAnimation both show them (fade them in) and move them into position?