Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#
# Copyright (c) 2010 Warren Merrifield
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
<html>
<head>
<title>TouchEvent detection for iPhone/iPod/iPad</title>
<script type="text/javascript">
var isTouch = (function() {
var event, feature = false,
support = function() { feature = true; },
element = document.createElement('div');
// How to make a universal binary
// Step 1: Create an iPhone project
// Step 2: Go into Target Settings and set arch to arm6 and arm7
// Step 3: Set base SDK to 3.1.3 and under the deployment tab set device family to iPhone/iPad
// Step 4: Create an iPad NIB from an existing NIB and then add the following code to load a different NIB if you set the deployment version to iPhone SDK 3.2 (To target the iPhone you need to use 3.1.3)
// Settings notes
// Base SDK = iphone devise 3.2
// Target Devise Family = iPhone/iPad
// iPhone OS Deployment Target = iphone devise 3.1.3

Rounded rectangle with gradient background on the iPhone, NSTokenFieldCell style.

Screenshot

Unlike my previous implementation, this one is drawn inside a single view using Core Graphics. It can thus be used for optimized, fast-scrolling cells per Apple's TableViewSuite sample.

The gradient shades are changed from that implementation, too, and the border itself is gradiented (by drawing a smaller rectangle inside a larger one that becomes the border).

You need to include the uicolor-utilities category by Ars Technica.

<!-- Screencast "Designing Web Content for iPhone @ 20:59 - "Viewport Examples"
<!-- Default viewport width = 980px -->
<!-- https://developer.apple.com/webapps/docs/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/chapter_4_section_5.html -->
<meta name="viewport" content="width=device-width, user-scalable=no">
<!-- or -->
<meta name="viewport" content="maximum-scale=1.0,width=device-width,initial-scale=1.0">
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>iPhone 3.0 geolocation demo</title>
<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"/>
<script>
function handler(location) {
var message = document.getElementById("message");
message.innerHTML ="<img src='http://maps.google.com/staticmap?center=" + location.coords.latitude + "," + location.coords.longitude + "&size=300x200&maptype=hybrid&zoom=16&key=YOURGOOGLEAPIKEY' />";
#!/usr/bin/perl
use warnings;
use strict;
use File::Find;
use File::Spec::Functions qw(rel2abs);
use File::Basename;
use Cwd;
my $dir = dirname(rel2abs($0));
<!doctype html>
<html>
<head>
<meta name = "viewport"
content = "user-scalable = no, maximum-scale=1.0, initial-scale = 1.0, width = device-width, height = device-height">
<script>
lt="qwertyuiopasdfghjklzxcvbnm "
lt+="1234567890"
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
NSSet *touches = [event allTouches];
BOOL forwardToSuper = YES;
for (UITouch *touch in touches) {
if ([touch tapCount] >= 2) {
// prevent this
forwardToSuper = NO;
}
}
if (forwardToSuper){
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
public class MyDatasource : UITableViewDataSource
{
object[] dataArray;