After I wrote the initial version of my panorama view, I decided to port ViewDeck from ViewDeck. This was mostly to have something like that available to use with MonoTouch and partly to see what it would be like to port an Objective-C library to C#. All in all it went well and you can find it here. It did highlight something which I had glossed over and, to be quite honest, I had forgotten in my haste. I should have used view controller containment in order to allow a user of the panorama to add views that have a controller.
The UIPanoramaView is now a UIPanoramaViewController. ViewControllers are added to the panorama like
1
|
|
Any view controller that is added to the panorama can access the panorama as the view controller’s ParentViewController. Doing so will allow a view controller to present another controller. This will animate the new controller into place.
1 2 |
|
Likewise, a view controller can Dismiss a presented controller.
Other than that, it’s pretty much the same functionality. I changed the internal implementation from a UIScrollView to a simple UIView and used a UIPanGestureRecognizer for panning. One of the reasons I did this was to better mimic the panorama control from Windows Phone and Track 8. My original panorama was a little too smooth in panning and wouldn’t stop at the start of each item properly - it would just slide on past because the scroll view had too much momentum.
Changing from a scroll view to use a gesture was pretty much a no brainer, getting the offsets right was a bit tricky on a late night :)
I hope you find this useful and any comments or suggestions welcome.
Cheers.