Archive for category Mac OS X

Boher Architecture iPhone app now available on iTunes

An app I recently built for Boher Architecture in Midhurst just went live on the iStore! You can get it for free from itunes.apple.com/us/app/boher/id539358624?ls=1&mt=8.

It features;

  • Categorised Unit Converter covering Length, Area, Distance, Mass and many more!
  • A graphical roof pitch calculator
  • A complete set of UK building regs for reference, available when you’re on site, even without mobile signal
  • Portfolio and contact details for Boher Architecture

Boher Architecture can also be contacted via their, soon-to-be-launched website at www.boherarchitecture.com

No Comments

Rotating child UIView when parent UITabBar or UINavigationController isn’t rotatable!

I’m building an app at the moment, with what is most likely a pretty fairly use case. It is a tab based app (Using StoryBoard/ iOS5.0/ XCode 4.3.2) , so at the top I have a UITabBarController, UINavigationController’s coming off of a few different tabs, then UIViewControllers coming off of those.

I DON’T want the home screen’s to be rotatable, but I do want one of my child UIView’s (a picture gallery, of course!) to be rotatable.

My UITabBarController at the root of the application had the following method;

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

This will make sure the views at the top don’t rotate, so I figured I would just add add the following to my gallery view controller to make just that one rotatable;

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{   
    return (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeRight || interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}

But I found nothing happened when I rotated. I set a bunch of break points and found the method in my gallery detail controller wasn’t even hit, but the parent TabBarControllers method was still being hit. The trouble is, you can’t rotate a view unless it’s parent is marked as rotatable.

After some head scratching, the solution was actually pretty simple- I created a switch on my root TabBarController “allowRotation”, then adjust the shouldAutorotateToInterfaceOrientation method in the tabBarController to;

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if (self.allowRotation)
        return YES;
    else
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

Then in my gallery detail view I set that switch to true when you enter the view;

-(void) viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    RootTabBarController *tabcontrol = (RootTabBarController*)[self tabBarController];
    tabcontrol.allowRotation = YES;
}

And when you click the back button at the top of the view, I quickly set the switch back to false;

- (void)willMoveToParentViewController:(UIViewController *)parent
{
    RootTabBarController *tabcontrol = (RootTabBarController*)[self tabBarController];
    tabcontrol.allowRotation = NO;
}

I tried doing this on viewWillDisappear and a bunch of other methods, but found none of them fired early enough to get in there before the back button fired off it’s magic to prepare the parent views rotation.

NOTE: Make sure you’re app has rotation enabled in the Project Target “Summary” sheet, otherwise none of this will work!

2 Comments

Mobile HTML5 Offline app links

I’m looking at writing some apps I did on the iPhone a while ago (the first of which will be Karma) to be mobile html5 offline accessible apps, using html5 audio/ canvas etc- so I’ll use this post to collect some useful links for research;

Also decided to use this as an opportunity to mess with nodejs, using one of the “nosql” db platforms;

http://blog.mongodb.org/post/812003773/node-js-and-mongodb

http://nodejs.org/

1 Comment

PhoneGap – Deselecting All Items from the tab bar!

Doing a bit of iPhone development at the mo and needed to remove a highlight from a tab bar when i moved to another page- In your javascript on your page put;


window.uicontrols.selectTabBarItem('');

No Comments

Mac Safari Web Developer Tools (inc javascript debugging!)

make sure you don’t have safari running, then go to the terminal window and type;

defaults write com.apple.Safari IncludeDebugMenu 1

You will have a new menu when you launch safari entitled “develop” in safari 5, and “debug” i believe in earlier versions.

No Comments

Karma, now available on iTunes!

My first published iPhone app, “Karma” is now available on the iTunes store http://itunes.com/apps/karma

No Comments

Cocos2d documentation on Easing effects for animating sprites

just found this ; http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:actions_ease?s=ease after ages of searching! shows you how to do smooth scrolling movements which ease out.

No Comments

GDC – Austin 2009 Tickets Booked!

yank-copyJust booked my tickets for the Game Developer Conference, Austin Texas! Woo!  Signed up for the iPhone game development sessions– quite exciting.  My very first trip to the US, and it will be to, what I’ve always imagined to be, the most stereotypically American part of America I could possibly visit (controversial , I know)!

No Comments

Showing Hidden files on the Mac OS

at the console type;

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

To swap back, execute the same code but with FALSE!

No Comments

IPhone Code Masters!

Paul Ledger and I have just setup a dedicated IPhone Development blog to post all things IPhone related as well as house the support forums for app’s we produce up at IphoneCodeMasters.com

No Comments