Archive for category Objective C

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

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

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

MORE iPhone links

I’m currently down with man-flu, however have found the next tutorial to have a go with when I’m back – on iCodeBlog is a multi-part tutorial taking you through building your own iphone tennis app!  I shall update this post as i find other stuff

No Comments

iPhone Hello World! (and other iPhone dev links!)

My very first iPhone App!  Good tutorial to help you actually get your hands dirty! – the same site also hs a bunch of other iphone tutorials which are worth a look and i shall be attempting over the coming days..

First iPhone Application – iPhone SDK Articles.

Some good video tutorials for starting out with iphone development

Christo’s iPhone Dev Page.

A useful beginners guide for iPhone development which I’m about to embark on! eek!

Trails in the Sand » Blog Archive iPhone Development: Objective-C Primer ».

No Comments