This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My View Controller : | |
using System; | |
using System.Drawing; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
using Async.iOS; | |
namespace FrankAutoLayout |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum HardwareVersion | |
{ | |
iPhone2G, | |
iPhone3G, | |
iPhone3Gs, | |
iPhone4, // retina | |
iPhone4s, | |
iPhone5, | |
iPhone5c, | |
iPhone5s, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UIView GetStatusBar() | |
{ | |
return (UIView) UIApplication.SharedApplication.ValueForKey (new NSString("_statusBarWindow")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UIImage ImageWithFont(string fontName,float fontSize,SizeF imageSize,UIColor color,string text) | |
{ | |
if (fontName != null && text != null && color != null) { | |
UIGraphics.BeginImageContextWithOptions (imageSize, false, 0.0f); | |
NSAttributedString attrString = new NSAttributedString (text, new UIStringAttributes () { | |
Font = UIFont.FromName (fontName,fontSize), | |
ForegroundColor = color | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[DllImport ("/usr/lib/libobjc.dylib")] | |
extern static IntPtr class_getInstanceMethod (IntPtr classHandle, IntPtr Selector); | |
[DllImport ("/usr/lib/libobjc.dylib")] | |
extern static Func<IntPtr,IntPtr,IntPtr> method_getImplementation (IntPtr method); | |
[DllImport ("/usr/lib/libobjc.dylib")] | |
extern static IntPtr imp_implementationWithBlock (ref BlockLiteral block); | |
[DllImport ("/usr/lib/libobjc.dylib")] | |
extern static void method_setImplementation (IntPtr method, IntPtr imp); | |
static Func<IntPtr,IntPtr,IntPtr> original_impl; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^(void) { | |
NSData *data0 = [NSData dataWithContentsOfURL:someURL]; | |
UIImage *image = [UIImage imageWithData:data0]; | |
dispatch_sync(dispatch_get_main_queue(), ^(void) { | |
UIImageView* imageView = (UIImageView*)[cell viewWithTag:100]; | |
imageView.image = image; | |
}); | |
}); |