comicscavern:

I am fairly confident that this app description was written by Borat.

haha!

comicscavern:

I am fairly confident that this app description was written by Borat.

haha!

11 notes

I just finished the first stage of the new CatPaint website. This is live now.
I still have to bring back the Gallery, news, and videos, but that’ll come in time.

I just finished the first stage of the new CatPaint website. This is live now. I still have to bring back the Gallery, news, and videos, but that’ll come in time.

1 note

iOS Interface Elements

Some interface icons for iOS. Taken from my app Double Exposure, and put on github for the common good.

Previous Next Settings Gear Swap Camera (Front/Rear) Camera Icon

1 note

Ignore touches to UIView subclass, but not to its subviews

Note: I’ve moved all future technical/programming posts out of this blog and over to objectivesea.tumblr.com. Follow that one if you’re going to follow me for technical junk.

If you want a UIView subclass to ignore touch events, just set its userInteractionEnabled property to NO. But that will block touches to all its subviews. To ignore touches in a UIView subclass, but not its subviews, just work a little hitTest magic:

-(id)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
    id hitView = [super hitTest:point withEvent:event];
    if (hitView == self) return nil;
    else return hitView;
}
8 notes

How to set default values for NSUserDefaults

NSUserDefaults is a great place to store your apps settings. It is convenient, available everywhere, and integrates nicely with settings bundles. One problem you run across with NSUserDefaults, is setting default values for your settings. There is a very simple elegant solution to this, detailed below.

Define keys

Use defines to keep keys consistent I usually have one header file just for keys I use throughout the project.

Create a defaults property list

Set default values in a new property list Create a new property list, and enter default values for all your settings. Make sure the keys match the ones you #define-d. Also pay attention to the types.

Set defaults on launch

The following code needs to run every time your app launches (in case your NSUserDefaults have gotten nuked or mangled). I added the following three lines to application:didFinishLaunchingWithOptions: in my app delegate.

NSString *defPath = [[NSBundle mainBundle] pathForResource:@"DEF" ofType:@"plist"];

NSDictionary *defaultsDict = [NSDictionary dictionaryWithContentsOfFile:defPath];

[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDict];

Fantastic, you are done.

Android (Open vs. Closed)

iPhone

Access to photos is via the internal photo library api, or the camera api. Neither provide any “meta data” about the photos. Meta data includes things like the location the photo was taken. The upshot of this is unless you explicitly grant an app access to use your location, it cannot get it.

Android

Photos loaded from the sd card or from the camera api include meta data. If you don’t grant an app permission to use your location, it can get it anyway.

1 note

DMURLConnection

A very very light wrapper for NSURLConnection. I wrote it, found it useful, thought that I would share. For when you need to send an HTTP post request and download some kind of response asynchronously.

Why is levitaco not a word??

Why is levitaco not a word??

Notes

This is what programming looks like. At least, this is what it looks like when I’m not actually writing code.

This is what programming looks like. At least, this is what it looks like when I’m not actually writing code.

"She pulls out her iPhone and shows me a photo of herself in period costume, wearing what is indeed a fantastic wig. The picture is covered in cats. “Have you seen the CatPaint app?” she asks excitedly. “It will change your life. Look at all the cats I’ve added!"

Emma Stone in October’s Nylon

I AM CATPAINT!!!!!!

(Source: kmnml)

41 notes

David Cronenberg’s iPhone charger

(Source: youtube.com)

NSDateFormatter format strings for Twitter and Facebook

Format strings for processing dates from facebook or twitter’s json api’s

//2010-09-12T22:21:18+0000
#define DF_FACEBOOK @"yyyy-MM-dd'T'HH:mm:ssZZ"
// Sun Sep 12 17:06:56 +0000 2010
#define DF_TWITTER @"EEE LLL dd HH:mm:ss ZZ yyyy"

Usage:

NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setTimeStyle:NSDateFormatterFullStyle]; // important
[df setDateFormat:DF_TWITTER];
NSDate *date = [df dateFromString:dateStringTwitter];
[df release];

Where DF_TWITTER would be DF_FACEBOOK, if you were processing facebook json instead of Twitter.

How to vertically center a UITextView

Note: I’ve moved all future technical/programming posts out of this blog and over to objectivesea.tumblr.com. Follow that one if you’re going to follow me for technical junk.

This took me ages to figure out how to vertically center the text in a UITextView. There really ought to be a property to set, but there isn’t so… this is pretty easy.

In -(void)viewDidLoad, add this to observe the contentSize key value:

[textView addObserver:self forKeyPath:@"contentSize" options:(NSKeyValueObservingOptionNew) context:NULL];

Then add this method, which adjusts the contentOffset every time the contentSize value changes.

-(void)observeValueForKeyPath:(NSString *)keyPath   ofObject:(id)object   change:(NSDictionary *)change   context:(void *)context {
 UITextView *tv = object;
 CGFloat topCorrect = ([tv bounds].size.height - [tv contentSize].height * [tv zoomScale])  / 2.0;
 topCorrect = ( topCorrect < 0.0 ? 0.0 : topCorrect );
 tv.contentOffset = (CGPoint){.x = 0, .y = -topCorrect};
}

Et voila!

4 notes

Assassin’s Creed: Altair’s Chronicles is not a good game

Looking for something fun, I busted a few bucks and bought this. The demo was fun. The game, however, is not. The only challenge the game presents is struggling with the controls. Just so you know.