Páginas

FPPopover, iPad-like popovers for iPhone ported to Xamarin Monotouch

Important information!! I have a new (and better) PopOver port to c# monotouch, that is more beautiful and works better. Go to http://vackup.blogspot.com.ar/2012/11/a-new-and-better-popover-port-to-c.html

I'm a c# developer and now I'm developing iphone apps so I use Monotouch (http://xamarin.com/monotouch/).

In an app I'm developing, I need a Popover for iphone but browsing the web I realize Apple's Popover doesn't work with iPhone (only iPad).

I found several popovers that work with iPhone and the best one is FPPopover from 50Pixels and it's open source source!!

FPPopover is an alternative to the native iOS UIPopoverController, adding support for iPhone and additional opportunities to customize the look and feel of the popovers.
Features
  • Works like UIPopoverController.
  • Runs on both iPhone and iPad.
  • Popover rendered using no images, only Quartz code.
  • Customize the look of popovers (color, dimensions).
  • Automatic orientation. It will find the best orientation and size for every situation.
  • MIT License (you can use it for commercial apps, edit and redistribute).


FPPopover is written in Objective C as every popover I found :( and I don't have any experience with Objective C and Xcode

Binding Objective C popover (http://docs.xamarin.com/ios/advanced_topics/binding_objective-c_types) was a really mess and hard to debug so I decided to port it to c# and after a week fighting (and learning) with objective-c I finally and successfully ported @50pixels FPPopover to c#.



These are the links I found useful in my path of porting (and also learning) objective C




I have a couple of things to mention:
  1. RectangleF.Inflate(); use negative values!!!
  2. Like C, objective C objects don't need to be initialize before access them. In c# you get a NullReferenceException
  3. RectangleF is a value-type (struct), not a reference type. You cannot change their properties / fields in .NET without creating a new instance (directly or indirectly);

You can download source code from https://bitbucket.org/hzaldivar/fppopoversharp (and also a sample app)

Follow me: https://twitter.com/vackup

Help me, downloading my game "A comic of zombies" starring Obama, thanks!: