Skip to content

Instantly share code, notes, and snippets.

@mluton
mluton / gist:1697428
Created January 29, 2012 05:34
iOS: Setting a Background Image on a UIView
UIColor *background = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"bkg.png"]];
self.view.backgroundColor = background;
[background release];
@mluton
mluton / gist:1697493
Created January 29, 2012 06:02
iOS: UIView Rounded Corners
#import "QuartzCore/QuartzCore.h"
viewOutlet.layer.cornerRadius = 25;
@mluton
mluton / gist:1814165
Created February 13, 2012 06:06
iOS: UITabBarController with UINavigationController Views
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
UIViewController *viewController1 = [[[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil] autorelease];
UIViewController *viewController2 = [[[TableViewController alloc] initWithNibName:@"TableViewController" bundle:nil] autorelease];
UINavigationController *navigationController1 = [[[UINavigationController alloc] initWithRootViewController:viewController1] autorelease];
UINavigationController *navigationController2 = [[[UINavigationController alloc] initWithRootViewController:viewController2] autorelease];
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
@mluton
mluton / gist:1847702
Created February 16, 2012 20:43
Get current time from system adjusted to PST
Time.now.in_time_zone "Pacific Time (US & Canada)"
@mluton
mluton / gist:1849081
Created February 17, 2012 00:14
iOS: Minimum Table View Code
#pragma mark - Table View
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
@mluton
mluton / gist:1856520
Created February 18, 2012 00:30
JQuery Sortable List with Grabby Hands (Webkit-Only)
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Sortable</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.min.js"></script>
<style>
#list {
list-style: none;
}
@mluton
mluton / gist:1870840
Created February 20, 2012 19:17
Minimal HTML5 Boilerplate
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
</body>
@mluton
mluton / gist:1891042
Created February 23, 2012 06:18
iOS: UI Element Heights
Status Bar: 20 px
Navigation Bar: 44px
Tab Bar: 50px
@mluton
mluton / gist:1934867
Created February 28, 2012 20:19
Web: Vertically Center Image with Dynamic Width
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Fluid Banner</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<style type="text/css" media="screen">
#container {
margin: auto;
width: 80%;
@mluton
mluton / gist:1983768
Created March 6, 2012 05:21
iOS: Change text color of label
fontName.textColor = [UIColor colorRed];