• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Question on NSTableViewDataSource Protocol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question on NSTableViewDataSource Protocol


  • Subject: Question on NSTableViewDataSource Protocol
  • From: Varun Chandramohan <email@hidden>
  • Date: Fri, 16 May 2014 01:18:11 +0000
  • Thread-topic: Question on NSTableViewDataSource Protocol

Hi All,

I was playing around with dragging items into NSTableView and I ran into a interesting problem. When I drag an item into my table, the following delegate gets called.


- (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id<NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation {

    [self performInsertWithDragInfo:info row:row];

    return YES;

}

Since I am returning YES, we are accepting this drop. In "performInsertWithDragInfo", I have a requirement to save the new add into a file and then parse through NSArray which is my data source and might make some modifications. After the modifications, I reload the datasource and repopulate the tableview.


    [_tableContents removeAllObjects];

    for (NSString *fileStr in filtered) {

        NSURL *fileURL = [NSURL URLWithString:[fileStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];

        DesktopEntity *entity = [DesktopEntity entityForURL:fileURL];

        if ([entity isKindOfClass:[DesktopEntity class]])

            [_tableContents addObject:entity];

    }

    [ltableView reloadData];

This is bad idea as I am doing this inside " performInsertWithDragInfo" before I return from tableView:(NSTableView *)tableView acceptDrop:(id<NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation which looks wrong to me. However I did not observe any issues on 10.9 where I extensively tested this. When I ran the same code on 10.7 I started noticing issues.

May 16 09:49:55 Mac-107-Test-Machine GUD[13022]: *** Assertion failure in -[NSTableRowData _addRowViewForVisibleRow:withPriorView:], /SourceCache/AppKit/AppKit-1138.51/TableView.subproj/NSTableRowData.m:2484
May 16 09:49:55 Mac-107-Test-Machine GUD[13022]: Row 1 should be in the valid visible section
I don't know why this is not seen in 10.9.
Is there any delegate that would get called after acceptDrop? In the documentation I saw tableView:draggingSession:endedAtPoint:operation: but I don't think its relevant here. Am I missing something?

Regards,
Varun
_______________________________________________

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


  • Follow-Ups:
    • Re: Question on NSTableViewDataSource Protocol
      • From: Graham Cox <email@hidden>
    • Re: Question on NSTableViewDataSource Protocol
      • From: Jerry Krinock <email@hidden>
  • Prev by Date: Re: White rectangle behind UIAlertView when subview clipsToBounds
  • Next by Date: where to put persistent storage for command-line app
  • Previous by thread: Re: NSDatePicker : Displaying and binding to nil.
  • Next by thread: Re: Question on NSTableViewDataSource Protocol
  • Index(es):
    • Date
    • Thread