Skip to content

Instantly share code, notes, and snippets.

@martinbowling
martinbowling / TempCache.cs
Created January 25, 2011 04:36
TempCache Code
using System;
using System.IO;
namespace Tables06
{
public class TempCache
{
public readonly static string BaseDir = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "..");
public readonly static string PicDir = Path.Combine (BaseDir, "Library/Caches/Pictures/");
public readonly static string TmpDir = Path.Combine (BaseDir, "tmp/");
@martinbowling
martinbowling / MTGraphicsHelperFunctions.cs
Created February 17, 2011 03:17
Graphics Helper Functions
using System;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreAnimation;
namespace MTUtils
{
public class Graphics
{
static CGPath smallPath = MakeRoundedPath (48);
@martinbowling
martinbowling / AnimationService.cs
Created April 29, 2011 01:00 — forked from follesoe/AnimationService.cs
MonoTouch animation helper by @alex_york and @follesoe
public static class AnimationService
{
public static void FadeOut(this UIView view, float duration = 1.0f, float opacity = 0.0f)
{
Animate(duration, () => {
view.Layer.Opacity = opacity;
});
}
public static void Animate(double duration, Action block)
@martinbowling
martinbowling / gist:1233161
Created September 21, 2011 20:17 — forked from Clancey/gist:1047006
MapView With MKPolyLines For route
using System;
using MonoTouch.UIKit;
using System.Collections.Generic;
using MonoTouch.MapKit;
using System.Threading;
using ClanceysLib;
using MonoTouch.Foundation;
using System.Linq;
using MonoTouch.CoreLocation;
using System.Drawing;
using System;
using ClanceysLib;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using System.Threading;
using MonoTouch.ObjCRuntime;
using System.Drawing;
using MonoTouch.CoreGraphics;
using System.Linq;
namespace Collaborate
@martinbowling
martinbowling / CustomNavButton.cs
Created September 27, 2011 16:58
CustomNavButton
using System;
using System.Drawing;
using MonoTouch.CoreGraphics;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.ObjCRuntime;
namespace SWVCVB
{
@martinbowling
martinbowling / gist:1245619
Created September 27, 2011 17:01
CustomNavButton & CustomNavBackButton
public class CustomNavBarBackButton : UIButton
{
private const float MAX_WIDTH = 160.0f;
private const int CapWidth = 14;
UIImage buttonImage;
string buttonTitle;
public event NSAction Tapped;
@martinbowling
martinbowling / gist:1245622
Created September 27, 2011 17:03
Example Usage of CustomNavBackButton
var n = NavigationController as UICustomNavigationController;
backButton = new CustomNavBarBackButton(UIImage.FromBundle("Images/navigationBarBackButton.png"), title, delegate{
NavigationController.PopViewControllerAnimated(true);
});
UIBarButtonItem bb = new UIBarButtonItem(backButton);
@martinbowling
martinbowling / scale.cs
Created November 11, 2011 17:40 — forked from nicwise/scale.cs
Scale and Rotate an image in iOS / MonoTouch, using the EXIF data
public static UIImage ScaleImage(UIImage image, int maxSize)
{
UIImage res;
using (CGImage imageRef = image.CGImage)
{
CGImageAlphaInfo alphaInfo = imageRef.AlphaInfo;
CGColorSpace colorSpaceInfo = CGColorSpace.CreateDeviceRGB();
if (alphaInfo == CGImageAlphaInfo.None)
@martinbowling
martinbowling / NotificationBar
Created November 29, 2011 00:06 — forked from Clancey/NotificationBar
NotificationBar
using System;
using ClanceysLib;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
using System.Threading;
using MonoTouch.ObjCRuntime;
using System.Drawing;
using MonoTouch.CoreGraphics;
using System.Linq;
namespace Collaborate