Archive for 'Programming'

UI Design Patterns

If you’ve got anything to do with designing iPhone interfaces — on paper or not — do not miss this post over at the new to us but worthwhile looking Flyosity blog about the advantages and disadvantages of different types of conventional iPhone application view organization

These three main interaction concepts correspond to three different types of View Controllers: Navigation Controllers, Tab Bar Controllers, Modal View Controllers and Table View Controllers respectfully. These are the building blocks for crafting iPhone applications.

and designing custom interfaces as well, with several paradigms of each type. Nothing overly surprising, but a nicely crafted overview, and the custom examples chosen are particularly interesting.

h/t: Daring Fireball!

Continue Reading →

iPhone Stencil Kit

Now here’s something that we bet you didn’t see coming as an aid to your iPhone UI design: a stainless steel stencil. Yes, the kind that works with paper.


Personally, we figure Interface Builder live design is the way to go when trying out interface ideas … but hey, there is a body of opinion out there that believes in paper prototyping, and if you’re one of them, this is for you, indeed. Besides, it just looks cool, doesn’t it now?

h/t: LinkedIn!

Continue Reading →

GUI Elements with Keynote

Now here’s a clever-sounding workflow for whipping together some reasonably attractive non-standard GUI elements for your iPhone project in short order; particularly useful for trolls, who as artists are really good programmers, if you get our drift.

Turns out that Keynote, which chances are fairly good you probably have on your machine even if you didn’t realize it as part of iWork, is very good at creating custom buttons and the like.

Then he recommends you just shimmy the shapes Keynote produces through the Acorn image editor, which apparently handles them quite gracefully — we wouldn’t know, so far we’ve found GraphicConverter the heartwarmingly geekiest of bitmap editors for us, but when we give this plan a whirl next time we want a funky button we’ll try out Acorn if GraphicConverter happens to not handle Keynote creations gracefully — et voilà, you have Xcode/IB-ready graphic files!

Easier to watch than describe, check out the video to see a demonstration.

We also note from the comments that OmniGraffle is suggested for this kind of designer-challenged design as well, so there’s another option.

h/t: iPhoneFlow!

Continue Reading →

Snippet: NaturalDates

Snippet time again: here’s an NSDate category for you to easily provide “Today”, “Yesterday” etc. in style, which is a friendly kind of thing to do when you have a date denoted kind of list:

@implementation NSDate (NaturalDates) 

- (BOOL)isSameDay:(NSDate*)anotherDate 
   NSCalendar* calendar = [NSCalendar currentCalendar]; 
   NSDateComponents* components1 = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:self]; 
   NSDateComponents* components2 = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit) fromDate:anotherDate]; 
   return ([components1 year] == [components2 year] && [components1 month] == [components2 month] && [components1 day] == [components2 day]); 

- (BOOL)isToday 
   return [self isSameDay:[NSDate date]]; 

- (BOOL)isYesterday 
   NSCalendar* calendar = [NSCalendar currentCalendar]; 
   NSDateComponents *comps = [[NSDateComponents alloc] init]; 
   [comps setDay:-1]; 
   NSDate *yesterday = [calendar dateByAddingComponents:comps toDate:[NSDate date]  options:0]; 
   [comps release]; 
   return [self isSameDay:yesterday]; 

- (BOOL)isLastWeek 
   NSCalendar* calendar = [NSCalendar currentCalendar]; 
   NSDateComponents *comps = [calendar components:NSWeekCalendarUnit|NSDayCalendarUnit fromDate:[NSDate date] toDate:self options:0]; 
   NSInteger week = [comps week]; 
   NSInteger days = [comps day]; 
   return (0==week && days<=0); 

- (NSString *)stringFromDateCapitalized:(BOOL)capitalize; 
   NSString *label = nil; 
   NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; 
   NSString *dateFormatPrefix = nil; 
   [dateFormatter setDateStyle:NSDateFormatterNoStyle]; // Will display hour only, we are building the day ourselves 
   [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; 
   if([self isToday])
      if(capitalize) dateFormatPrefix = NSLocalizedString(@"Today at", @""); 
      else dateFormatPrefix = NSLocalizedString(@"today at", @""); 
   else if([self isYesterday])
      if(capitalize) dateFormatPrefix = NSLocalizedString(@"Yesterday at", @""); 
      else dateFormatPrefix = NSLocalizedString(@"yesterday at", @""); 
   else if([self isLastWeek])
      NSDateFormatter *weekDayFormatter = [[NSDateFormatter alloc] init]; 
      // We will set the locale to US to have the weekday in english. 
      // The NSLocalizedString(weekDayString, @"") below will make it 
      NSLocale *locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]; 
      [weekDayFormatter setLocale:locale]; 
      [locale release]; 
      [weekDayFormatter setDateFormat:@"EEEE"]; 
      NSString *weekDayString = [NSString stringWithFormat:@"%@ at", [weekDayFormatter stringFromDate:self]]; 
      dateFormatPrefix = NSLocalizedString(weekDayString, @""); 
      [weekDayFormatter release]; 
      [dateFormatter setDateStyle:NSDateFormatterShortStyle]; // Display the date as well 
   if(dateFormatPrefix != nil)
   { // We have a day string, add hour only 
      label = [NSString stringWithFormat:@"%@ %@", dateFormatPrefix, [dateFormatter stringFromDate:self]]; 
   { // Use the full date 
      label = [dateFormatter stringFromDate:self]; 
   [dateFormatter release]; 
   return label; 


… yes, we know, it’s just about impossible to actually read the code, we really must get around to finding the time to sort out a theme with a light background and none of this dumb wrapping. One of these days…

h/t: iPhoneSDK!

Continue Reading →

iPhone Recipes submissions

Got any iPhone code snippets that demonstrate your cleverness? Well, here’s an opportunity to show them off:

We’re looking for bite sized recipes for our “iPhone Recipes” book to be published by the Pragmatic Bookshelf. This is your opportunity to show your chops to the community as a whole. In particular, we’re looking for easily understandable, general purpose recipes that aren’t already well documented. We’re not asking you to share your application’s secret sauce, just a few of the toppings.

To propose a recipe idea, here’s what we need from you:

A paragraph or two describing the problem that the recipe solves.
A sentence or two indicating what the solution will be.
The OS version(s) to which the recipe applies.

Email your idea to us at by August 1st (or sooner!)

If your recipe is selected, your name, bio, and a link to your site/blog will appear in the book. You’ll also receive a complimentary copy of the book, of course.

Well, that’s a nice try at getting people to write you a book for free, appeal to their vanity, isn’t it now? Be interesting to see how this works out for them! If we can find some spare time before August 1st it’ll probably work on us, after all…

Continue Reading →

Snippet: Texture Sizes

Here’s a cute little snippet for automatically transmogrifying your OpenGL textures into iPhone-acceptable dimensions at runtime if you don’t want to go to the trouble of sorting out the source assets, because maybe you’re porting existing assets from another platform, or your artists can’t follow directions, or whatever:

First off, figure out power-of-two dimensions:

  1. //     Adjust the width and height to be a power of two
  2. if( (_width != 1) && (_width & (_width – 1)) )
  3. {
  4. i = 1;
  5. while((sizeToFit ? 2 * i : i) < _width)
  6. i *= 2;
  7. _width = i;
  8. }
  9. if( (_height != 1) && (_height & (_height – 1)) )
  10. {
  11. i = 1;
  12. while((sizeToFit ? 2 * i : i) < _height)
  13. i *= 2;
  14. _height = i;
  15. }

You could figure that out on your own no doubt, but you might miss this; if it turns out that the image is too big, your friend CGAffineTransform can sort that out for you!

  1. //      scale down an image greater than the max texture size
  2. while((_width > kMaxTextureSize) || (_height > kMaxTextureSize))
  3. {
  4. _width /= 2;
  5. _height /= 2;
  6. transform = CGAffineTransformScale(transform, 0.5, 0.5);
  7. imageSize.x *= 0.5;
  8. imageSize.y *= 0.5;
  9. }

That’s quicker than going through and canonizing a large asset base yourself, indeed. Read the rest of the article for further explanation; and this is part of the D’Jinn Engine for the iPhone which can be found on Google Code. Enjoy!

h/t: iPhoneDevelopmentBits!

Continue Reading →

Tutorial: Proximity Monitoring

More of a snippet this time than a tutorial really, over in the MobileOrchard iPhone 3.0 series; how you can now be as cool as Google.

When Google released their iPhone app last year it was accompanied with a bit of controversy:

Their app used an undocumented API to detect when the phone had been placed next to the speaker’s ear.

In iPhone 3.0 SDK this API is usable by any app. This short article demonstrates how to use it:

Actually, it hardly needs a demonstration — all that there is to do to get your monitoring going is set [UIDevice currentDevice].proximityMonitoringEnabled = YES; and listen for the notification.

But hey, if you still had the impression from the brouhaha over Google getting to be special that normal developers weren’t allowed to do the same thing — now you know how you can too!

Continue Reading →

No doubt you’re already aware that many developers are upset about the apparent, ah, capriciousness of the App Store approval process. Whilst we’re certainly no strangers to that feeling ourselves — at the moment we have one set of apps on the store with a known crash on 3.0 that Apple won’t approve a fix for, and another app that’s been ‘In Review’ seventy-three days and counting — we haven’t gone out of our way to whine about it because really, what would that accomplish? But here is a truly splendid rant on the subject which talks about the problems with getting apps approved that are written with the PhoneGap project for building native, well native-ish, apps with JavaScript. Short version: Don’t try it.

But aside from the amusement factor, this led us to a site that did look like a good idea;, which is a compendium of rejection reasons that developers have provided. That would be useful information to keep track of, indeed! However, it seems to have only been active for a few days back in May, so apparently whoever put it up had second thoughts. Or maybe just nobody’s submitting anything. So if you do have an interesting rejection letter, we encourage you to send it to AppRejected and share with us all!

[EDIT: Here’s another blog dedicated to amassing rejection reasons. Support them all!]

h/t: Slashdot!

Continue Reading →


Here’s a handy little tool to add to your bag of iPhone programming tricks: iPhoneSimulatorExchange! What it’s for is to — wait for it — exchange iPhone Simulator binaries, eponymously enough:

Create 1-click installers of your iPhone Simulator apps to share with other developers for testing. Or to send it to someone to create Screencasts for reviews.

There’s actually been a good number of times when we just wanted a client’s feedback on a proposed workflow or the like and we’d wished that there was a way to get something quickly without the whole send me your device ID let me issue a new provisioning certificate now try and get iTunes to recognize it yadayadayada. And especially when we needed something signed off on by someone who doesn’t actually have an iPhone at all. Yes, that happens. But finding any old Mac to install the SDK on, now that’s a great deal less of a burden! So we’re quite looking forward to using this. It seems brain dead simple, start it up and it shows the apps installed in your simulator,


then just click the ‘Build Installer’ button and it creates a one-click installer with your splash screen, like


Double-click that, and it proceeds to install itself. Could it get any simpler? We think not. Yes, we can see this making working with clients a good deal less hassle, indeed. Much thanks to these GrandTotal fellows for this!

Continue Reading →

Outsourcing testing

Here’s a service to be aware of if you’re doing some desktop Mac development and need a beta tester pool, or if you’re the kind of user that glees in poking around in buggy prerelease software:, from the same people who run the most excellent prMac press release service for your Mac and iPhone press release needs. And what is exactly, you ask?

MacDeveloper is an opt-in service for testers who love what the Mac community offers and genuinely want to test. We feel the platform is an excellent alternative to Bundled software avenues. At the same time a developer’s software is being tested, they’re also giving back to the community who supports them.

MacDeveloper makes it fun for Beta Testers. Register to test your favorite software and receive coupons for FREE software, or purchase software at huge discounts.

MacDeveloper for Testers

   * Register and Test software absolutely free

   * Choose only the Software Categories that interest you

   * Earn Points for Testing your favorite Software

   * Use points to purchase software for FREE

   * Use points to purchase software for huge discounts

   * Earn valuable Star Ratings for being a Quality Tester

MacDeveloper for Developers

   * Create Project Channels for only $18.75

   * Upload as many binaries to Project Channels as you wish

   * Search the Beta Pool for Quality Testers

   * Find Beta Testers who genuinely have a desire to test

   * Use Coupons for Testers to purchase your Applications for free or at a discount

   * Excellent method for customer building

We haven’t happened to use it ourselves yet, but if one was to be looking for something a bit more structured than a public beta but didn’t have an inhouse QA staff or the budget for hiring out, this certainly does look like something worth giving a shot; there seems to be a pretty good selection of happy users, anyways, so apparently it works out pretty good for at least some people.

Of course, if even this much effort in beta testing strikes you as too much, there’s always the ‘call the first build that doesn’t burst into flames at launch the “Preview Edition” and start charging for it’ strategy…

Continue Reading →
Page 78 of 99 «...5060707677787980...»