Skip to content

Instantly share code, notes, and snippets.

@emarashliev
Created April 3, 2012 15:09
Show Gist options
  • Save emarashliev/2292796 to your computer and use it in GitHub Desktop.
Save emarashliev/2292796 to your computer and use it in GitHub Desktop.
- (void)copyItems:(id)sender {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
NSMutableArray *items = [NSMutableArray arrayWithCapacity:_selectionView.selection.count];
for (TTShapeModelObject *shp in _selectionView.selection) {
[item setObject:[NSKeyedArchiver archivedDataWithRootObject:shp] forKey:@"TTShapeModelObject"];
[items addObject:item];
}
pasteboard.items = items;
}
- (void)pasteItems:(id)sender {
CGPoint pos = _flags.contextMenuTouchPosition;
NSArray *items = [UIPasteboard generalPasteboard].items;
for (NSDictionary* itemDict in items) {
TTShapeModelObject *item = [NSKeyedUnarchiver unarchiveObjectWithData:[itemDict objectForKey:@"TTShapeModelObject"]];
item.position = pos;
[self addShape:item];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment