Thursday, May 3, 2012

Keep both view controllers in UISplitViewController portrait view

Hooray! Apple has created a UISplitViewController delegate to choose whether the master view controller is hidden or not on orientation change. If you start a project with the Master Detail application template, simple edit the [Project]DetailViewController.m file. At the bottom of this file you will find a #pragma mark - Split view, followed by all the delegate methods for the UISplitViewController. Simply add the following: -(BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation { return NO; } That will force the first view controller to stay in view upon orientation change (namely, portrait view.)

Wednesday, October 5, 2011

Why all the disappointment?

I keep seeing all these blogs/threads about how Apple blew it by not putting out a iPhone 5. But honestly, what would the iPhone 5 consist of that the 4S does not already cover? I can think of one thing: some new spiffy form factor with a slightly bigger screen.

As for form factor, the iPhone4 is already quite good. Is it just because we want something different, and not necessarily better? I don't think they could make things thinner with all the new guts they stuffed into the same case. A bigger screen, but same resolution... I'm not convinced that this would be all that much of an improvement. I certainly don't want a bigger phone, the iPhone 4 fits perfectly in the hand.

We know LTE would not be in the cards. It just isn't ready yet, and Apple isn't big on adopting technologies preemptively (unless they are innovating it themselves.)

So as for the 4S, let's list the highlights:

* A5 chip, x7 graphics
* longer battery life
* new antenna design
* 2x data speed over 3G
* enhanced camera
* CDMA/GSM in same phone
* iOS5/iCloud
* Find my Friends / Cards
* iTunes Match
* Siri

Ok, that is a pretty solid list of improvements. This really is a new phone, but just in the same form factor. Had we wrapped all this up in a new form factor and called it iPhone 5, would it suddenly get the praise and glory?

I think it's mostly perception. As a matter of fact, if Steve Jobs would have been the one on stage, I think things would have been perceived differently. He has a way of wowing the audience. "We started from scratch. We took the already beautiful iPhone 4 form factor, gutted it, and replaced every single component with something better."

[note] this is a copy of my post here.

Friday, February 4, 2011

Objective-C Semi-Singleton Class

Sometimes when building an iOS application, you will have a class you will want to access from anywhere. Such as, a controller with any number of child controllers (navigation, tab, etc.) and some of them need simple access back to the root controller.

Apple provides their own solution to creating a full-blown singleton class, but this can be a daunting task for a simple need. A semi-singleton is much easier to create but has two caveats:

1) semi-singletons only work if there is ever only one instance of the class
2) the singleton cannot be used to initialize itself

So, here is how to make a simple "HelloWorld" class into a semi-singleton.

In the HelloWorld.m file, create a static property to hold the singleton instance:


// put just after @implementation line
static HelloWorld* helloWorldInstance;


in the init method, assign the instance (self) to the static property:


-(id) init
{
if ((self = [super init]))
{
// assign the semi-singleton
helloWorldInstance = self;
// do other init stuff here ...
}
return self;
}


create the shared static method for accessing the semi-singleton:


+(HelloWorld*) sharedInstance {
return helloWorldInstance;
}


Lastly, be sure to dealloc the property to avoid crashes:


-(void) dealloc
{
helloWorldInstance = nil;
[super dealloc];
}


And now from any class, we can access a pointer to the instance:


#import HelloWorld.h

HelloWorld *helloWorld = [HelloWorld sharedInstance];


And there you have it. Thanks to Steffen Itterheim and his book about cocos2d programming for the original tip!

Wednesday, December 22, 2010

Apple TV: A perfect replacement for digital picture frames

I never really liked the idea of digital picture frames. At first they were overpriced and very poor picture quality. Now they are getting better with higher resolution, more options for getting photos to them (SD card slot, USB, Wifi), but there is still a problem with them. They are single purpose devices, and Grandma doesn't want to fidget with loading images.

Along comes the AppleTV (Gen 2) from Apple for $99. A black hockey puck with one HDMI cable, power cable, and very simple remote. Now here is a perfect replacement for digital picture frames. I have a MobileMe account where I keep all of my photo albums up to date. Now Grandma can flip on her AppleTV and view all the new photo albums I put onto MobileMe with no work on her part. The slideshow viewer is absolutely gorgeous, and quite configurable. Now Grandma can view the photos on her TV in a much larger format instead of a dinky digital picture frame, and I manage the albums.

Not only is the AppleTV a good slideshow viewer, but you can watch Netflix, rent movies and tv shows, use airplay to push content to the TV from another iOS device, and you know an app store is in the works... but the picture viewer alone is worth the price to purchase for Grandma.

Although MobileMe is $99 bucks a year, it's well worth it for the automated syncing of addresses, bookmarks, passwords, etc. between all your Mac devices. And of course, simple management of shared photo/video galleries for the family.

So if you plan on getting a digital picture frame for a gift, spend the dollars on an AppleTV instead. It's a much better investment.

Tuesday, November 9, 2010

PHP5 References Explained Visually

If you are having trouble wrapping your head around PHP5 References, especially how objects are now handled, have a look at this handy guide.

Wednesday, September 8, 2010

Compress/GZip CSS the easy way with Apache and PHP

So you need a way to automatically compress CSS and GZIP to the browser without any complicated work on the development end? This script is for you.


Just access the .css files from the browser as per usual.

Monday, July 19, 2010

First thoughts on Droid

So my wife got a Droid. Not because she even wanted one, but because she was tired of messaging on her ancient Motorola Razor. She was going to get a non-droid phone on the cheapo data plan, but she eventually settled on a Droid, mainly for me to tinker with.

Well, my first impressions are not so good. I've been using the iPhone for a few years, and the inconsistency on this phone just baffles me. The first thing I wanted to do was unlock the phone. I couldn't even figure that out, until I saw the sales guy slide his finger over the green button on the screen. There was absolutely no visual cue of how that worked. Then as I started browsing through the pages of icons, it really reminded me of the smartphones I tried before the iPhone was around: inconsistent and clumsy.

I'm not even going to discuss features, because to me they really don't matter as much as the user experience. Bottom line, the user experience has to be good, and Apple has nailed that down. I could go on, but I found a good article that pretty much sums it all up.