2

I'm working on MonoTouch binding project to integrate GMGridView into my application. I was able to successfully load the empty Grid view but was not able to load grid items. After spending hours on MonoTouch & Objective C code, it turned out that System.Drawing.SizeF binding is incorrectly translating to CGSize (i.e, SizeF(140f, 110f) is translating to CGSize(140, 0) - value of height is lost).

Objective C Definition

    - (CGSize)GMGridView:(GMGridView *)gridView sizeForItemsInInterfaceOrientation:(UIInterfaceOrientation)orientation;

Monotouch Binding

    [Abstract, Export ("GMGridView:sizeForItemsInInterfaceOrientation:")]
    System.Drawing.SizeF SizeForItemsInInterfaceOrientation (GMGridView gridView, UIInterfaceOrientation orientation);

I was wondering if I'm binding it incorrectly or this is a known bug? Also, what would be a resolution other than creating additional callback for height value.

Binding and test code is posted here: GMGridMono

Thanks for looking into this.

Aarpy
  • 121
  • 2
  • 7
  • Great idea, MonoTouch really lacks a Grid View component. I'll try to help you with the port as soon as I have some time. – Emanuele Sabetta May 13 '12 at 09:29
  • Sure, feel free to update the project. For now, I'm creating an additional callback to pass height. – Aarpy May 13 '12 at 14:20
  • Which version of MonoTouch are you using and does this happen in the simulator or on device (or both)? I just tried with 5.2.11 and I couldn't find any problems in the simulator (I printed out the return value from SizeForItemsInInterfaceOrientation in SlidesGridView.cs:29, and they're fine). – Rolf Bjarne Kvinge May 14 '12 at 10:47
  • @RolfBjarneKvinge Thanks for looking into it. It is happening in the simulator. I havent tested with the device. I'll test and update the post. – Aarpy May 14 '12 at 17:23
  • I see this project has been discontinued :( https://github.com/rpulipati/GMGridMono – Danyal Aytekin Jan 10 '13 at 16:07

1 Answers1

1

I have encountered the same issue with bindings to a method returning CGSize. Monotouch V5.2.12. It happens on the simulator but not on the device. A direct call from a mono application to the method works fine, but when the method is used as a callback from the bound library to the mono code the returned Height value is incorrect and appears ininitialized.