Hi All,

 

I am trying to get finder icon view like behavior in my application.  Using
IKImageBrowserView I am able to show icons for contents of a directory but I
also need file/directory name below those icons. For this I am trying to
insert NString into NSImage but text is now showing up in
IKImageBrowserView.

 

NSImage *img = [[NSWorkspace sharedWorkspace] iconForFile:[path
stringByAppendingPathComponent:file]];

//NSImage *img = [[NSImage
alloc]initWithContentsOfFile:@"/Users/ashisht/Desktop/downloads.png"];

NSString *imgID = [file lastPathComponent];

[img       setName:imgID];

 

 [img lockFocus]; 

NSFont *txtFont = [NSFont boldSystemFontOfSize:13];

NSDictionary *txtDict = [NSDictionary 

 
dictionaryWithObjectsAndKeys:txtFont,

                                                NSFontAttributeName, nil];

NSString* myString = @"ABCDE"; 

 [myString drawAtPoint: NSMakePoint(0, 0) withAttributes: txtDict]; 

                                

 [img unlockFocus];

 

Please tell me what I am doing wrong, is there any other way of attaching
text to NSImage (result should be NSImage)?

Note: IKImageBrowserView IB connections are proper also reloadData and other
delegates are working fine.

 

Thanks in advance.

 

Ashish Tiwari 

 

 

_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to