Cool thanks ill give that a try later

Regards
Peter Garner

Development

Hospitality Development Manager
e-mail = [email protected]
tel = 01425 891028 ext 228
fax = 01425 461484
web = http://www.tigerTMS.com

 


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of technohead
Sent: 19 August 2011 16:52
To: [email protected]
Subject: Re: [MonoTouch] uitableview insertrows


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

-- 
This message (including attachments) is intended only for the use of the 
individual or entity to which it is addressed and may contain information that 
is non-public, proprietary, privileged, confidential, and exempt from 
disclosure under applicable law. If you are not the intended recipient, you are 
hereby notified that any use, dissemination, distribution, or copying of this 
communication is strictly prohibited. If you have received this communication 
in error, notify us immediately by telephone and delete this message 
immediately.
Any views or opinions presented are solely those of the author and do not 
necessarily represent those of TigerTMS unless otherwise specifically stated.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to