Re: IKImageBrowserView drag and drop/reordering when using core data [SOLVED]
Re: IKImageBrowserView drag and drop/reordering when using core data [SOLVED]
- Subject: Re: IKImageBrowserView drag and drop/reordering when using core data [SOLVED]
- From: "email@hidden" <email@hidden>
- Date: Tue, 13 Jan 2009 20:28:28 +0000
IKImageBrowserDataSource Protocol has the answer.
For non file path represented images we need to implement -
imageBrowser:writeItemsAtIndexes:toPasteboard:
/*
write images to paste board
need for dragging of non path represented images
*/
- (NSUInteger) imageBrowser:(IKImageBrowserView *) aBrowser
writeItemsAtIndexes:(NSIndexSet *) itemIndexes toPasteboard:
(NSPasteboard *)pasteboard
{
NSInteger index;
for (index = [itemIndexes lastIndex]; index != NSNotFound; index =
[itemIndexes indexLessThanIndex:index])
{
GoodThing *goodThing = [[imageBrowserViewArrayController content]
objectAtIndex:index];
[pasteboard setData:goodThing.imageRepresentation
forType:NSTIFFPboardType];
}
return [itemIndexes count];
}
On 13 Jan 2009, at 14:43, email@hidden wrote:
I have been utilising the IKImageBrowserViewWithCoreData Apple
sample code and wished to add drag and drop and reordering
functionality.
Another Apple sample project, image-browser, covers most of the
detail.
My problem is the following:
Drag and drop from say the finder works okay (if one can figure out
that setting IKImageBrowserView -draggingDestinationDelegate seems
broken in IB).
Reordering within the view itself, however, fails.
By experimentation I have determined that this is because our image
representation (as per the IKImageBrowserItem informal protocol) is
IKImageBrowserNSDataRepresentationType.
In other words, we are storing an NSData rep of our image in the
Core Data store.
Modifying the code to use a IKImageBrowserPathRepresentationType
gives working reordering but only an image path in the store.
It would seem that the browser view itself will not initiate a drag
for a data representation.
Has anyone successfully overridden the IKImageBrowserView's dragging
behaviour?
Jonathan Mitchell
Central Conscious Unit
http://www.mugginsoft.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
Jonathan Mitchell
Central Conscious Unit
http://www.mugginsoft.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden