D90 Video I captured at last night’s tree trimming party, with music added in iMovie.
Lots more photos here.
iOS and Mac developer
D90 Video I captured at last night’s tree trimming party, with music added in iMovie.
Lots more photos here.
In an application I’m working on, I display a UIWebView with a navigation bar. I wanted to display the title of the web page in the navigation bar when I load a page, but there doesn’t appear to be any obvious way to do it.
There’s actually a very easy way to get the title (or any other property) of a page in a web view: stringByEvaluatingJavaScriptFromString:.
In this case, I use the delegate method webViewDidFinishLoad to obtain the page title and set the title of the navigation bar,
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
NSString* title = [webView stringByEvaluatingJavaScriptFromString: @"document.title"];
navbar.title = title;
}
The result looks like this:
Coda is my favorite web development environment on the Mac, combining a syntax-aware editor, a visual CSS editor, and an FTP client that can sync local changes to the web server. Until I read this item at Dra Studio, I had no idea you could add custom books to Coda.
Adding books to Coda is very simple – simply click the ‘+‘ button at the bottom of the Books page and enter the book title, main URL, and a search URL. You can find URLs for some useful books to add at Dra Studio & SitePoint.
I find the WordPress documentation (codex.wordpress.org) especially useful when working on WordPress plugins or themes.
One of the changes I’m making in the next version of ICanHasCheezburger is improved multi-touch handling. In the current version, I’m only handling left & right swipes to switch to the previous or next images. For the update, I’d like to handle the same gestures as the photo app:
In many cases you can use a UIScrollView, which implements most of those behaviors. For ICHC, I decided to subclass UIImageView to handle touch gestures.
I like to check Flickr’s camera finder page every few days to see how popular the D90 is. As I write this, the D90 is ranked 15 of 102 Nikon models. Less than a week ago, it wasn’t even listed. Yesterday it was #19, a jump of 4 places in one day.
Here’s a shot I took today with my 50mm lens at f1.8. I love being able to use auto focus with that lens.

Since the F**KING NDA makes it difficult to find iPhone programming tips & sample code, I thought I’d share this little tidbit.
Sometimes the easiest way to display a help or information screen is a UIWebView. It’s very easy to display the contents of an HTML file stored in the application’s resource bundle.
NSData *info = [NSData dataWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"info" ofType:@"html"]]; [webView loadData:info MIMEType:@"text/html" textEncodingName:@"utf8" baseURL:nil];
However, if you have any external links, they will open in the same web view, which you probably don’t want. I found a very nice work-around to have any clicked URLs open in Safari. You’ll need to specify a delegate for your web view that implements the webView:shouldStartLoadWithRequest:navigationType method. The code is very simple.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType { if (navigationType == UIWebViewNavigationTypeLinkClicked) { [[UIApplication sharedApplication] openURL: [request URL]]; return NO; } return YES; }
Kudos to Craig Hockenberry for defying Apple’s F***ING NDA and releasing the source code for an iPhone game, Lights Out, as inspiration for aspiring iPhone developers.
For the past few months I’ve been working on a server administration application (I can’t go into specifics). It was ported Windows code that included some MFC emulation using old-fashioned Mac APIs such as WaitNextEvent. As expected, it never worked reliably and I was starting to feel defeated by it.
I figured out that the actual server code consisted of self-contained C++ objects that had very little to do with the application code. I ended up throwing away most of the old application code and grafting the server code into a modern Cocoa application using some ObjectiveC++ bridge classes. Once I got it to build, it took less than a day to get it working, and in the process fixed lots of long-standing bugs.