Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to copy image in NSPasteBoard

    • 0
    • 1
    • 1
    • 1
    • 0
    • 0
    • 0
    • 0
    • 1.72k
    Comment on it

    To copy the image on NSPasteBoard following code can be used:

    - (IBAction)paste:sender
     {
            NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
            NSArray *classArray = [NSArray arrayWithObject:[NSImage class]];
            NSDictionary *options = [NSDictionary dictionary];
    
            BOOL ok = [pasteboard canReadObjectForClasses:classArray options:options];
    
            if (ok){
    
                NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options];
                NSImage *image = [objectsToPaste objectAtIndex:0];
                [imageView setImage:image];
            }
    
        }
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: