# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1616536989 0 # Node ID deb2345f45185ed2c1766b777594c983070026f7 # Parent 47b214db24651f9b17d9dbdb231a7bd75c2045cc iOS: Implement the UITableViewDataSource protocol so DWContainer doesn't crash. Remove the old NSTableView code that was there for reference. diff -r 47b214db2465 -r deb2345f4518 ios/dw.m --- a/ios/dw.m Tue Mar 23 20:25:56 2021 +0000 +++ b/ios/dw.m Tue Mar 23 22:03:09 2021 +0000 @@ -1461,13 +1461,11 @@ id scrollview; int filesystem; } --(NSInteger)numberOfRowsInTableView:(UITableView *)aTable; -#if 0 /* TODO: Switch to columnless versions */ --(id)tableView:(UITableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow; --(BOOL)tableView:(UITableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex; --(void)tableView:(UITableView *)tableView didAddRowView:(UITableRowView *)rowView forRow:(NSInteger)row; --(UIView *)tableView:(UITableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row; -#endif +-(NSInteger)tableView:(UITableView *)aTable numberOfRowsInSection:(NSInteger)section; +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; +-(void)tableView: (UITableView*)tableView willDisplayCell: (UITableViewCell*)cell forRowAtIndexPath: (NSIndexPath*)indexPath; +-(void)addColumn:(NSString *)input andType:(int)type; +-(NSString *)getColumn:(int)col; -(void *)userdata; -(void)setUserdata:(void *)input; -(void)setFilesystem:(int)input; @@ -1495,8 +1493,9 @@ @end @implementation DWContainer --(NSInteger)numberOfRowsInTableView:(UITableView *)aTable -{ +-(NSInteger)tableView:(UITableView *)aTable numberOfRowsInSection:(NSInteger)section +{ + /* Ignoring section for now, everything in one section */ if(tvcols && data) { int cols = (int)[tvcols count]; @@ -1508,53 +1507,10 @@ } return 0; } -#if 0 /* TODO: Switch to columnless versions */ --(id)tableView:(UITableView *)aTable objectValueForTableColumn:(NSTableColumn *)aCol row:(NSInteger)aRow -{ - if(tvcols && data) - { - int z, col = -1; - int count = (int)[tvcols count]; - - for(z=0;z -1) { return [titles pointerAtIndex:row]; } return NULL; } -(void *)getRowData:(int)row { if(rowdatas && row > -1) { return [rowdatas pointerAtIndex:row]; } return NULL; } --(id)getRow:(int)row and:(int)col { if(data) { int index = (int)(row * [tvcols count]) + col; return [data objectAtIndex:index]; } return nil; } +-(id)getRow:(int)row and:(int)col { if(data && [data count]) { int index = (int)(row * [tvcols count]) + col; return [data objectAtIndex:index]; } return nil; } -(int)cellType:(int)col { return [[types objectAtIndex:col] intValue]; } -(int)lastAddPoint { return lastAddPoint; } -(int)lastQueryPoint { return lastQueryPoint; } @@ -5300,10 +5263,12 @@ for(z=0;z