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
No hay comentarios.:
Publicar un comentario