Páginas

Mostrando las entradas con la etiqueta objc2csharp. Mostrar todas las entradas
Mostrando las entradas con la etiqueta objc2csharp. Mostrar todas las entradas

ImageCropper for iOs c# monotouch version

I have ported the excellent ImageCropper for iOs control from Objective C to C# Monotouch

ImageCropper for iOs is a drop-in image cropper for iOS (as seen in Photos app, UIImagePickerController)

I like this controle because it's so so simply and it shows images like iPhone Photos app (and I was looking for any sample!)




As always, you can download source source from https://bitbucket.org/hzaldivar/imagecroppersharp

I made a PhotoAlbumViewController based on this control and Escoz's PagedViewController. I'll upload source code soon!

A new (and better) PopOver port than FPPopover to c# Xamarion Monotouch iOs

Here you have my new (and better) PopOver port from Objective C to c# Xamarion Monotouch iOs than FPPopover.
I started a new port because my last popover port was so buggy and not so beautiful like this! You can find it here: https://bitbucket.org/hzaldivar/popoverviewsharp/



Use it to display:
  • Single String
  • Multiple Strings
  • Single UIView
  • Multiple UIViews
  • All Above + Titles


You can find the original popOver at http://blog.getsherpa.com/blog/2012/09/14/popoverview-a-flexible-modal-content-view-for-ios/ with usage information and more samples. It's really easy and awesome!

Drop me a line or follow me:
https://twitter.com/vackup


Please support my work by downloading my game "A comic of zombies" starring Obama and visting ad banners! Thanks!

A Comic of Zombies for iOs

A Comic of Zombies for PC



Last but not least, here you have the articles I found useful while porting

NSArray

The MonoTouch runtime automatically takes care of converting C# arrays to NSArrays and doing the conversion back,.
The idea is to use a strongly typed C# array as this will allow the IDE to provide proper code completion with the actual type without forcing the user to guess, or look up the documentation to find out the actual type of the objects contained in the array.
In cases where you can not track down the actual most derived type contained in the array, you can use NSObject [] as the return value.
http://docs.xamarin.com/ios/advanced_topics/binding_objective-c_types#Arrays

If you go to the MonoTouch API Design page and do an in-page search for "NSArray", you'll find this: Instead of dealing with NSString and NSArray the runtime instead exposes these as C# strings and strongly typed arrays throughout the API.
http://stackoverflow.com/questions/1855478/using-nsarray-with-monotouch

MonoTouch: Where is Frame.Origin?

http://stackoverflow.com/questions/8826697/monotouch-where-is-frame-origin

What's the point of NSAssert, actually?

Assert is to make sure a value is what its suppose to be. If assertion fails that means something went wrong and so the app quits
http://stackoverflow.com/questions/1375786/whats-the-point-of-nsassert-actually

Using UIGestureRecognizer in MonoTouch

Using selector

http://dan.clarke.name/2012/08/using-uigesturerecognizer-in-monotouch/
http://docs.xamarin.com/index.php?title=ios/recipes/content_controls/scroll_view/implement_tap-to-zoom&action=source

Using lambda expression

http://monotouch.2284126.n4.nabble.com/UITapGestureRecognizer-can-t-get-to-work-td4656380.html
https://github.com/xamarin/monotouch-samples/blob/master/Touch/Screens/iPhone/GestureRecognizers/GestureRecognizers_iPhone.xib.cs

Animate Using Blocks

http://docs.xamarin.com/ios/recipes/Animation/CoreAnimation/Animate_Using_Blocks

respondsToSelector - Delegates

http://monotouch.2284126.n4.nabble.com/respondsToSelector-td3536741.html

UIBezierPath

http://es.scribd.com/doc/53062638/88/UIBezierPath

http://docs.xamarin.com/ios/Guides/Advanced_Topics/Binding_Objective-C_Libraries
http://iosapi.xamarin.com/index.aspx?link=M%3AMonoTouch.UIKit.UIColor.SetFill()

Private methods

http://macdevelopertips.com/objective-c/private-methods.html
http://stackoverflow.com/questions/2158660/why-doesnt-objective-c-support-private-methods

Introduction to Objective C

http://blog.teamtreehouse.com/an-introduction-to-objective-c
+ static (class) methods
- normal (instance) methods





Rounding up the corners of a UIView, Monotouch c# version

Today I needed to round some corners of an UIView in an app I'm developing and I remember a great article from our friends of Infinixsoft at http://infinixsoft.com/2012/09/rounding-up-the-corners-of-a-uiview/

But, as I'm a Monotouch c# developer and the article was written in objetive C here's the port:


using MonoTouch.UIKit;
using MonoTouch.CoreAnimation;
using System.Drawing;


public static class Utils
{
        public static void RoundView(this UIView self, UIRectCorner rectCorner, float radius)
        {
            var maskPath = UIBezierPath.FromRoundedRect(self.Bounds, rectCorner, new SizeF(radius, radius));
            var maskLayer = new CAShapeLayer();
            maskLayer.Frame = self.Bounds;
            maskLayer.Path = maskPath.CGPath;
            self.Layer.Mask = maskLayer;
            maskLayer.Dispose();
        }
}

I developed it as static extension method of UIView, so to use it just (for eg)

NavigationController.NavigationBar.RoundView(UIRectCorner.TopLeft | UIRectCorner.TopRight, 5.0f);

Enjoy it!
https://twitter.com/vackup