peter.garner wrote:
> 
> Hi does anyone have a code snippet to create a dynamic array of
> NSIndexPath
> 
> Eg ive seen a static example
> Table.insertrows(new
> NSIndexPath[]{ind1,ind2,ind3},UITableViewRowAnimation.Fade) which adds 3
> hardcoded rows
> 
> What I want to do is insertrows dynamically so my datasource may hold 3
> rows or may hold 20 rows so I need to build a dynamic NSIndexPath
> 
> So something like
> Table.insertrows(mycreatednsindexarray,UITableViewRowAnimation.fade);
> 
> Regards
> Pete
> 
> 
> 



I've used C#'s generic List collection to build the array of NSIndexPath as
follows:

        
        List<NSIndexPath> tmpArray = new List<NSIndexPath>();
        
        for(int i = indexPath.Row + 1; i < indexPath.Row + rows + 1; i++)
        {
                NSIndexPath tmpIndexPath = NSIndexPath.FromRowSection(i,
indexPath.Section);
                tmpArray.Add(tmpIndexPath);     
        }
                                
                                
        if (currentlyExpanded)
        {
               tableView.DeleteRows(tmpArray.ToArray(),
UITableViewRowAnimation.Top);
        }
        else
        {
                tableView.InsertRows(tmpArray.ToArray(), 
UITableViewRowAnimation.Top);
        }
                                

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/uitableview-insertrows-tp3754934p3755518.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to