Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / Duh.cs
Created January 25, 2011 00:56
duh - placeholder
/*
basedir/AppName.app Where the executables live. This is also the current working directory (Environment.CurrentDirectory).
basedir/Documents Where application-specific data files are stored. (This directory is backed up by iTunes.)
basedir/Library/Preferences Application-specific configuration settings. You should manage your settings using the NSUserDefaults class. (This directory is backed up by iTunes.)
basedir/Library/Caches Use this directory to store any cache data to be used across invocations of the application.
Your application is responsible for removing data files from this directory when it no longer needs them.
@martinbowling
martinbowling / iPhoneAppDirs.cs
Created January 25, 2011 00:48
iPhone Application Directory
/*
basedir/AppName.app Where the executables live. This is also the current working directory (Environment.CurrentDirectory).
basedir/Documents Where application-specific data files are stored. (This directory is backed up by iTunes.)
basedir/Library/Preferences Application-specific configuration settings. You should manage your settings using the NSUserDefaults class. (This directory is backed up by iTunes.)
basedir/Library/Caches Use this directory to store any cache data to be used across invocations of the application.
Your application is responsible for removing data files from this directory when it no longer needs them.
@martinbowling
martinbowling / hasFreeSpace.cs
Created January 25, 2011 00:45
Does Drive Have Free Space?
public bool hasFreeSpace()
{
System.IO.DriveInfo[] drives = System.IO.DriveInfo.GetDrives();
foreach (System.IO.DriveInfo drive in drives) {
if (drive.Name.ToString() == "/")
{
if (drive.IsReady) {
Console.WriteLine(drive.AvailableFreeSpace);
if (drive.AvailableFreeSpace > 1000)
@martinbowling
martinbowling / UITableViewCellDeleteConfirmationControlShift.cs
Created January 23, 2011 21:50
Move the UITableViewCellDeleteConfirmationControl on a UITableViewCell
public override void LayoutSubviews ()
{
// LayoutSubviews is called each time that we enter Editing Mode, So Lets Take This Opportunity To
// Show or Hide any elements we want
base.LayoutSubviews();
if (this.Editing)
{
this.DetailTextLabel.Hidden = true;
IntPtr sel = Selector.GetHandle ("description");
//IntPtr sel = Selector.GetHandle ("class");
public override void Draw (RectangleF rect)
{
base.Draw(rect);
UIImage img = UIImage.FromFile("Images/navigation_background.png");
img.Draw(new RectangleF(0,0, 320,44));
}
using System;
using MonoTouch;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
using System.Text;
using System.IO;
namespace MRB
{
using System;
using MonoTouch;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.CoreGraphics;
using MonoTouch.ObjCRuntime;
namespace iDailyBooth
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace MonoTouch.UIKit {
[BaseType (typeof (UIButton))]
interface UIGlassButton {
[Export ("initWithFrame:")]
IntPtr Constructor (RectangleF frame);