Showing posts with label programatically. Show all posts
Showing posts with label programatically. Show all posts

Tuesday, 5 November 2013

How to hide status bar in iOS7

This post is about the UIStatusBar issue with the iOS 7, Xcode based applications. In your latest application, you can hide the UIStatusBar on application launch by selecting the Hide during application launch property as below:





But this isn't enough for hiding the ststusbar inside the app. That is, inside your iOS 7 app, you may see the status bar as it is:



For solving this, just do the following:
  • Open your info.plist
  • Add a row and name it as : View controller-based status bar appearance and set it to NO


That is: 

<key>UIStatusBarHidden</key>
<true/>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>

We also attaching sample screenshot for your information:



Monday, 3 June 2013

How to programmatically change the device orientation instantly: cocos2d

To change Device orientation instantly, use the following syntax:

Syntax:

    CCDirector *director = [CCDirector sharedDirector];
    [director setDeviceOrientation:kCCDeviceOrientationPortrait];  // set your desired orientation here

Friday, 31 May 2013

How to reset the image of a sprite: cocos2d

Cocos2d allows the programmer to reset the image of a sprite when needed. This can be done with the help of following code:




Syntax:

    [spriteName setTexture:[[CCTextureCache sharedTextureCache]
                                           addImage:@"newImageName.png"]];