-
Recent Posts
Recent Comments
Archives
- February 2023
- July 2022
- December 2021
- November 2021
- April 2021
- January 2019
- November 2018
- April 2018
- June 2014
- November 2013
- October 2013
- September 2013
- July 2013
- March 2013
- January 2013
- November 2012
- October 2012
- August 2012
- March 2012
- January 2012
- December 2011
- October 2011
- September 2011
- August 2011
- July 2011
Categories
Meta
Tag Archives: code snippet
Mistakes Were Made: Audio and ARC
There’s a mistake I have, to my own great embarrassment, made twice, so I think it’s worth writing up for posterity. This one’s brief: you can laugh at me and move on. Under ARC, AVAudioPlayers don’t retain themselves while playing. … Continue reading
Posted in Explanation
Tagged ARC, automatic reference counting, Beginners, cocoa, code snippet, iOS, mistakes were made, Mistkaes
Leave a comment
Premature Completion: An Embarrassing Problem
Working on a project recently, Jerry and I came across an odd bug. We have a two-level UI that allows the user to navigate between several different scroll views. For the sake of keeping things pretty, we want to reset … Continue reading
Posted in Explanation
Tagged animation, bugs, cocoa, code snippet, core animation, iOS, mistakes were made, Mistkaes, sample code
10 Comments
Cancel dispatch_after
Joel and I have been working on a project recently that relies pretty heavily on the delayed execution of blocks. It became evident pretty quickly that we needed a way to cancel these blocks. We worked around the problem in … Continue reading
Mistakes Were Made: Integral Bounds
Here’s another mistake from the day job. (Why do they pay us? Because we do eventually find and correct our errors?) “Misaligned” CATextLayers As you may know, the Core Animation instrument has a flag to “Color Misaligned Images“. This is … Continue reading
Posted in Code
Tagged CALayer, CATextLayer, code snippet, core animation, images, Instruments, iOS, mistakes were made, Mistkaes
Leave a comment
Quick Tip: Drawing Right Side Up With Core Text
Anyone who has decided to explore using Core Text on iOS has probably noticed that everything is drawn upside down. This is because Core Graphics contexts that have been created with functions provided by UIKit (such as UIGraphicsBeginImageContext, or the … Continue reading
Localizing Arbitrary Strings the Scripty Way
I bet you saw my post about localizing US states and said to yourself, “Ha! That little sed script won’t do much for arbitrary strings!” You’re a jerk, but yes, you’re right. Before I give it away, does anyone see … Continue reading
Localizing your US States array
Suppose you have a whiny co-worker who insists that all user-facing strings be localized. That’s what scripting tools are for, right? Specifically sed, in this case. sed ‘s/@”[^”]*”/NSLocalizedString(&, nil)/g’ This little script will match NSStrings and replace them with a … Continue reading
US States in an NSArray
Save yourself a little typing time, take advantage of mine. [NSArray arrayWithObjects:@”Alabama”, @”Alaska”, @”Arizona”, @”Arkansas”, @”California”, @”Colorado”, @”Connecticut”, @”Delaware”, @”Florida”, @”Georgia”, @”Hawaii”, @”Idaho”, @”Illinois”, @”Indiana”, @”Iowa”, @”Kansas”, @”Kentucky”, @”Louisiana”, @”Maine”, @”Maryland”, @”Massachusetts”, @”Michigan”, @”Minnesota”, @”Mississippi”, @”Missouri”, @”Montana”, @”Nebraska”, @”Nevada”, @”New … Continue reading