0

I have been in a pickle with this problem for a while now. When I try to manually handle how my table behaves while scrolling, everything works fine, except all my section headers disappear. What I tried to do was make the scroll view expand after I have scrolled for X number of points. The headers are not visible from the very start, but when I comment the override out, my headers are there as normal. Does anyone have any idea how I could fix this and make my section headers appear ?

A sample of my code is as follows :

    dialog.TableView.Scrolled += delegate {
if (dialog.TableView.ContentOffset.Y > this.View.Frame.Height)
{
dialogView.Frame = new RectangleF(0,0,320,this.View.Frame.Height);
}
};
Andrey Belykh
  • 2,578
  • 4
  • 32
  • 46
Raz_dl
  • 1

1 Answers1

1

If you subscribe to Scrolled on a UITableView, it will likely overwrite the underlying UITableViewSource that tells it how many sections/rows there are, etc.

It looks like you are using MonoTouch.Dialog, is the table simple enough where you could use a normal UITableView for this case? There is a Scrolled method you can override on UITableViewSourceinstead of using the C# event.

jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182
  • The problem is, it's not simple. The sections are custom, with custom headers and a tap event, the elements are also custom so basically it would be a ton of work to rewrite all that for this purpose :/ – Raz_dl Jun 19 '13 at 18:54
  • This is why I normally avoid MonoTouch.Dialog, you will have to look at the source and see if there is a way you can subclass the underlying `UITableViewSource` that dialog uses. If you had made the `UITableView` by hand, it would be easy. Maybe someone else can chime in with a solution, sorry. – jonathanpeppers Jun 20 '13 at 13:08