Forum Xamarin.iOS

Help needed with strange behaviour on a tableview's source

JohnHJohnH GBMember ✭✭✭✭✭
edited April 2014 in Xamarin.iOS

EDIT: Screencast of the issue:
screencast.com/t/51E1OceYGY

Hi guys,
Im having a desperate time with an issue Im having with a table view and its source. I have attached the code to the UITableViewSource which automatically populates an internal model containing 5 sections.

Tap the text in the section containing today's date and the table will be placed into edit mode. Drag the row titled 'A' from today's section downwards until you go maybe 7 rows past 'P', then back up to just above 'P' and drop it. You will see that the rows in the view kind of 'shiver', which is odd. Then tap on the drag icon for row 'A' and you will see a new row 'A' appear.

I haven't a clue why this is happening and my model code looks clean, which is why I created this sample code to prove the problem. If anyone can point a big finger and say 'mate you are doing this bit wrong, do this instead', I'll buy you a beer!

Also I removed all other code, including cell recycling just to prove the problem.

To run the code, add the attached unit to an existing project. In your view controllers ViewDidLoad simply run the following code:

table = new UITableView(View.Frame);
Add(table);
table.Source = new CustomSource(table);

also add a private variable to your view controller for the table object. The problem occurs on the sim as well as on a device, iOS7.

Cheers
John

Posts

  • adamkempadamkemp USInsider, Developer Group Leader mod

    I haven't tested your code, but I compared it to some of my code which also supports moving rows. I noticed that in your code in the MoveRow method you call tableView.MoveRow. My code doesn't do that, and that's because the table view has already moved that row in the view. All you have to do is update the model. Try deleting that line.

  • JohnHJohnH GBMember ✭✭✭✭✭

    @AdamKemp, yet again I am amazed at the level of help this community offers fellow developers, that was exactly the issue. If you are ever in London give me a shout to claim your free beer!

    Cheers
    John

  • DAVIDBUCKLEYDAVIDBUCKLEY GBMember

    Hi Guys i am about to make a project with parse and tableview do you have any small examples on how to wire up tableview and detail section to a list

  • DAVIDBUCKLEYDAVIDBUCKLEY GBMember

    @JohnHair‌ I have been looking for some example code on how to hook up a parse object to tablesource and he detail do you have any example code that you could share thanks

  • JohnHJohnH GBMember ✭✭✭✭✭

    @DAVIDBUCKLEY‌ I don't know what you mean by 'a parse object', can you elaborate?

  • DAVIDBUCKLEYDAVIDBUCKLEY GBMember

    @JohnHair I mean setting the table source to a object using parse.com i persume this is what you have done i am stuck trying to figure it out

  • DAVIDBUCKLEYDAVIDBUCKLEY GBMember

    @JohnHair I mean setting the table source to a object using parse.com i persume this is what you have done i am stuck trying to figure it out

  • JohnHJohnH GBMember ✭✭✭✭✭

    No, the code I have is very simple to wire up the source to the table:


    table.Source = new CustomSource(table);

    I have my CustomSource which contains the data I want to display in the table. Thats it. I am not sure what you are trying to use parse for.

Sign In or Register to comment.