Archive for March, 2011

31
Mar

TDSemiModal

So you know that thing where you can’t present transparent screens with -presentModalViewController, it always blanks out the view being presented over? Kinda annoying when what you really want is something like this, right?

aiequ.png

But it’s not overly difficult to fake it by animating views around, so that’s what we’ve done in the past. But today we had a situation where a full screen view navigated to on the phone was to be a modal view rolled up from the bottom on the iPad, and we really didn’t want to go to the effort of duplicating all the controller logic, so we looked around a bit to see if anyone clever had found a good way to handle the situtation — and as you can no doubt guess from the above shot, we found it:

iOS: Semi-modal date picker for iPhone

Title notwithstanding, it’s not just for date pickers, although the one above is provided; it’s a nice little piece open sourced on github to present any view controller and its bits with translucency where desired, which the author calls “semi-modal”; and pretty much all you have to do is

1) Instead of -presentModalViewController, call

-(void)presentSemiModalViewController:(TDSemiModalViewController*)vc;

2) Instead of -dismissModalViewControllerAnimated, call
-(void)dismissSemiModalViewController:(TDSemiModalViewController*)vc;
And that’s just about it! Well, there’s some hardcoded phone screen sizes in there, but it’s just a couple lines to make it iPad-friendly. Sure beats stacking all your rollup views and their logic in the parent … especially when you’ve got them already written as separate controllers, yep.

h/t: Stack Overflow!

30
Mar

NMView

Here’s a new library open sourced on github that looks pretty interesting: NMView!

Apple has gone a long way making it easy for iOS developers to create complex UIs, thanks to Interface Builder…

For creating a UIView component yourself, however, there is no standard way of using Interface Builder to graphically create the layout of your component. You are left to write many lines of code to arrange existing components into view hierarchies, change their properties only to notice that what you wrote in code did not lead to the intended layout. This process is tedious and convincing people to create their own UIView component is difficult since creating them is no fun.

To simplify the process of implementing UIView components, we’ve created NMView. NMView is a UIView subclass which defines a standard mechanism of associating a nib file with the view and how its contents are loaded into the view. Additionally, it provides advanced features like specifying different view layouts (eg. landscape vs. portrait) in the nib file which can either manually or automatically be activated based on the aspect ratio of the view…

We particularly like that feature. Here’s the included sample showing differing portrait/landscape layouts:

Screen shot 2011-03-31 at 12.02.15 AM.png

Screen shot 2011-03-30 at 11.57.41 PM.png

… with smooth animation of the individual views between the layouts as you rotate. Nice work. Can think of a couple projects that would’ve been mighty handy on. So yes, we thoroughly recommend you take a look at NMView as a handy addition to your bag of tricks!

29
Mar

TableView Sections

Ever wanted to expand or collapse UITableView sections? Well, no actually it’s never come up for us either; but if it ever does, this looks like a nice piece on how to do it as elegantly as possible:

Expanding/Collapsing TableView Sections

While giving many designers a headache the Twitter app still serves as template on how to solve a variety of UX riddles. One of which is the situation where one might want to have sections in a tableview that possess the ability to expand from one row to several and collapse vice versa.

The eye of the experienced developer sees two challenges contained therein: 1) grafting a mechanism for collapsing and expanding onto UITableView in a reusable way 2) making custom accessory views that look like a rotated version of the disclosure indicator, pointing upwards or downwards and also changing color when highlighted.

In this article I present my solution to this UX riddle…

Handy if you need it!

28
Mar

DateCalculations

This looks like a pretty handy piece of code if you’re putting together something that does, well, date calculations:

The goal to this library is to provide an easy interface for doing calculations with dates in Objective C (mac + iphone).

To use, simply drop the DateCalculations subdirectory inside your project and require “NSDate+Calculations.h”.

Currently implemented methods:

- (NSDate *)beginningOfDay;

- (NSDate *)beginningOfMonth;

- (NSDate *)beginningOfQuarter;

- (NSDate *)beginningOfWeek;

- (NSDate *)beginningOfYear;

Nothing too overly complicated, but hey beats doing it yourself!

h/t: @openiphonedev!

27
Mar

Sales Tracking: Mopapp

So things have been pretty quiet on the sales tracking front since the frenzied activity in that space a couple years back settled down, we’re still happily using AppViz on the desktop and appFigures to send out the various daily emails, far as we know it’s still the only option for automatically sending arbitrary app set reports to arbitrary email groups; but here’s a post on a new one that may be of some interest to those of you who swing multiple ways:

Mopapp – a multi-platform mobile sales analytics

“Multi-platform? What platforms would “multi” be exactly” you ask? Why,

Screen shot 2011-03-27 at 11.18.44 PM.png

… we’re not sure if that actually works out to “all of them” exhaustively, but it sure seems to cover all of them that anyone trying to make any money would ever be interested in!

h/t: @jfmartin67!

26
Mar

HOWTO: Web Apps

So, as perhaps you noted on an earlier post available briefly before the client decided that we were sharing too much so down the memory hole it went, Apple is starting to crack down on enforcing App Store Review Guidelines section

2.13: Apps that are primarily marketing materials or advertisements will be rejected

with a rejection letter reading

We found that your app provides a limited set of features and functionality, and focuses primarily on marketing or promoting your business, which is not appropriate for the App Store…

and will go on to suggest

Alternatively, you may wish to consider building a web app using HTML5. HTML5 is the major new version of HTML and enables audio and video to play natively in the browser without requiring proprietary plug-ins. Using HTML5, web apps look and behave like native iPhone and iPad apps, and using HTML5’s Offline Application Cache, your web apps work even when the device is offline. With web apps, you have flexibility to deliver as much or as little functionality as you desire.

To get started with iPhone or iPad web apps, please review “Getting Started with iPhone Web Apps” .

For a description of the HTML elements and attributes you can use in Safari on iPhone, check out “Safari HTML Reference: Introduction“.

which is all very well, but the couple client inquiries we’ve had since then that we’ve told “yeah, we think you’re risking THIS…” have had their web designers not be overly impressed with the understandability of those referrals.

So, here is what appears to be an definitive, succinct, and nicely geared to web designers’ sensibilities writeup:

HOWTO: Create native-looking iPhone/iPad applications from HTML, CSS and JavaScript

In this article, I’ll explain how to:

  • strip away the browser chrome (the url bar and button bar);
  • prevent viewport scrolling and scaling;
  • respond to multi-touch and gesture events;
  • use webkit CSS to get the iPhone OS look and feel;
  • cache the app so it runs without internet access;
  • get a custom icon on the home screen; and
  • have a splash screen load at the start.

If you want to put it in the app store, you can even package your web app as a “native” Objective-C app. (Although, why you’d want to subject yourself to the app store approval process when you don’t have to is beyond me.)

I’ve put this HOWTO together, because–even on Apple’s site–there’s not one centralized page that tells you how to do all this. I’ve included templates, examples and a stubbed-out XCode project…

Yes. Yes, that should do nicely as a Web App Making For Designers 101 that they’re likely to actually read, we’d say. Anything better you know of, Dear Readers?

h/t: @smashingmag!

UPDATE:

These look like more excellent resource for getting started on web apps:

Mobile Boilerplate – A Base Template For Mobile Web Apps

18 New Useful Frameworks for Web and Mobile App Developers

If the ‘Flash video!!!’ things comes up: Sublime Video

25
Mar

CoreText Wrapping

This looks like a useful article on CoreText, one of those APIs we don’t know nearly as much about as we’d like:

Wrapping text around a shape with CoreText

CoreText is a very powerful system for laying out text in arbitrary ways. This is going to be a bit of a whirlwind tour of it to help out nonamelive on StackOverflow. I’m working on an advanced iOS book right now, and I’ll have a longer writeup there. The primary tool for this project is the CTFramesetter. Its job is to layout runs of text into rectangles. So to use it, you need to break up your text areas into rectangles…

Good stuff, good stuff.

24
Mar

Speaking Binary Plist

So we’ve mentioned various options for fast JSON parsing for your data communications needs before; but if you really want speed of said communications, how to do it? Why, don’t use XML or JSON, naturally! That’s one of the points in this writeup, the rest of which is worth a read too:

Hipmunk for iPhone Post-Mortem

… Parsing large amounts of JSON sucks. Even on an iPhone 4.

Import times were upwards of five seconds, turning JSON into native collection objects and then mapping these to local Core Data entities. Just awful. Luckily, I work with people who are way, way smarter than I am. I asked hardcore Pythonista and Real Programmer Andre von Houck if he could make the server spit out Binary Plist files instead of JSON, saving me the parsing overhead.

A couple of days later, he’d written something from scratch to do this. Since I could skip the parsing, import times dropped by 2500ms. Andre is a badass…

Well, good on Andre. Let me check the desk drawers …. nope, no Andre. So that’s all very nice, but of not much immediate applicability to the Andre-less, it seems. Or, wait, does it?

… Compiling a plist server side doesn’t seem to be as big of a chore as you’d think. In fact, there’s a github project that will do the server side compilation for you…

Hmmm. That does sound interesting. “CFPropertyList”, you say?

The PHP implementation of Apple’s PropertyList can handle XML PropertyLists as well as binary PropertyLists. It offers functionality to easily convert data between worlds, e.g. recalculating timestamps from unix epoch to apple epoch and vice versa. A feature to automagically create (guess) the plist structure from a normal PHP data structure will help you dump your data to plist in no time…

… CFPropertyList does not rely on any “Apple proprietary” components, like plutil. CFPropertyList runs on any Operating System with PHP and some standard extensions installed.

Although you might want to deliver data to your iPhone application, you might want to run those server side services on your standard Linux (or even Windows) environment, rather than buying an expensive Apple Server. With CFPropertyList you now have the power to provide data from your favorite Operating System….

Well now, that’s even more interesting than it sounded. Plus there’s a Ruby version and a Python version if you’re too cool to do PHP. OK, next time we have some actual input into how server communications are to be done, we know what we’re pointing the web dudes at!

h/t: @pzearfoss!

23
Mar

MapKit Tutorial

Übertutor Ray Wenderlich is at it again — this time an excellent (but you knew that) introduction to, well,

Introduction to MapKit on iOS Tutorial

MapKit is a really neat API available on the iPhone that makes it easy to display maps, jump to coordinates, plot locations, and even draw routes and other shapes on top.

I’m writing this tutorial because about a month ago I attended a neat event in Baltimore called Civic Hack Day where I played around with MapKit to display some public data such as place locations, crime data, and bus routes. It was kind of fun so thought others might be interested to learn how it works …

Don’t skip right past it ’cause you think you know MapView already; let us draw your attention to

… In the process, you’ll learn how to … query and retrieve government data available via the Socrata API …

Betcha you don’t know how to do that yet. But soon!

UPDATE:

And after you’re introduced, check out: Adding polygon map overlays

22
Mar

Chameleon Project

So the big news of the iOS developer twitterverse today was — as chances are you know already, if you happened to be online at all — the unveiling of

Screen shot 2011-03-23 at 12.04.21 AM.png

If you’re an iOS developer, you’re already familiar with UIKit, the framework used to create apps for the iPhone, iPod and iPad. Chameleon is a drop in replacement for UIKit that runs on Mac OS X. In many cases, your iOS code doesn’t need to change at all in order to run on a Mac.

This new framework is a clean room implementation of the work done by Apple for iOS. The only thing Chameleon has in common with UIKit are the public class and method names. The code is based on Apple’s documentation and does not use any private APIs or other techniques disallowed by the Mac App Store…

We’ve noticed a pretty big upswing in people asking for Mac versions of their iPad projects since the Mac App Store was opened, so this will be most handy indeed, we suspect. Read the project site, and check out the code on github!