Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(UITableViewCell*)tableView:(UITableView *)ourTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- {
- NSString* className = [self classNameForIndexPath:indexPath];
- // Have to dequeue the cell before getting the row, because that's how we reuse rows as well.
- UITableViewCell *cell = [ourTableView dequeueReusableCellWithIdentifier:className];
- TiUITableViewRowProxy* row = [usingRows objectForKey:indexPath];
- if (row == nil) {
- row = [[self rowForClassName:className] retain];
- [row setRow:[indexPath row]];
- [self dequeueRow:row forIndex:indexPath];
- }
- NSDictionary * callbackArg = [NSDictionary dictionaryWithObjectsAndKeys:row,@"row",NUMINT([indexPath row]),@"index",nil];
- [[self proxy] fireCallback:@"rowLoader" withArg:callbackArg withSource:nil];
- TiThreadProcessPendingMainThreadBlocks(0.05,NO,^(BOOL * result){
- //TODO: If there is some way to detect that the callback has completed, now would
- //be a great time to do that.
- // if([self rowCachedForIndexPath:indexPath]) {*result = NO;}
- });
- [row triggerAttach];
- // TIME FOR C&P LOGIC FROM TABLEVIEW....
- if (cell == nil)
- {
- cell = [[[TiLazytableCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:row.tableClass row:row] autorelease];
- CGSize cellSize = [(TiUITableViewCell*)cell computeCellSize];
- [cell setBounds:CGRectMake(0, 0, cellSize.width,cellSize.height)];
- [[cell contentView] setBounds:[cell bounds]];
- }
- else
- {
- // TODO: Right now, reproxying, redrawing, reloading, etc. is SLOWER than simply drawing in the new cell contents!
- // So what we're going to do with this cell is clear its contents out, then redraw it as if it were a new cell.
- // Keeps the cell pool small and reusable.
- [TiUITableViewRowProxy clearTableRowCell:cell];
- // Have to reset the proxy on the cell, and the row's callback cell, as it may have been cleared in reuse operations (or reassigned)
- [(TiUITableViewCell*)cell setProxy:row];
- [row setCallbackCell:(TiUITableViewCell*)cell];
- }
- [row initializeTableViewCell:cell];
- [cell setIndex:indexPath];
- return cell;
- }
Add Comment
Please, Sign In to add comment