0

i am working with PXListView and i am testing with Demo App which came inside the PXListView...while doing the drag and drop it is not working properly... the drop is not working...

i have added the following delegate methods... but still dropping is not happened to the correct row...it is relocate back to its original row...

    - (BOOL)listView:(PXListView*)aListView writeRowsWithIndexes:(NSIndexSet*)rowIndexes toPasteboard:(NSPasteboard*)dragPasteboard
{
    // +++ Actually drag the items, not just dummy data.
    [dragPasteboard declareTypes: [NSArray arrayWithObjects: NSStringPboardType, nil] owner: self];
    [dragPasteboard setString: @"Just Testing" forType: NSStringPboardType];

    return YES;
}

- (NSDragOperation)listView:(PXListView*)aListView validateDrop:(id <NSDraggingInfo>)info proposedRow:(NSUInteger)row
                            proposedDropHighlight:(PXListViewDropHighlight)dropHighlight;
{
    return NSDragOperationCopy;
}

- (BOOL)listView:(PXListView*)aListView acceptDrop:(id <NSDraggingInfo>)info row:(NSUInteger)row dropHighlight:(PXListViewDropHighlight)dropHighlight
{
    return NO;
}

can anyone please help me to fix this problem?

Thanks & Regards, Muthu

mammaiap
  • 11
  • 2

1 Answers1

0

Here is your solution. You may want to fine tune it a bit, but it gets the job done.

- (BOOL)listView:(PXListView*)aListView acceptDrop:(id <NSDraggingInfo>)info row:   (NSUInteger)row dropHighlight:(PXListViewDropHighlight)dropHighlight
{
     NSLog(@"Accept Drop");
     NSString *temp = [_listItems objectAtIndex: [listView selectedRow]];
     [_listItems removeObjectAtIndex: [listView selectedRow]];
     [_listItems insertObject: temp atIndex: row];
     [listView reloadData];
     return NO;
}