Code Snippet: Adding a UIImage into a CALayer

As a example, by adding the code below into your viewDidLoad method a CALayer called backgroundImage will be displayed. This CALayer also takes on the contents UIImage named fixedBackgroundImage.

UIImage *backgroundImageSource = [UIImage imageNamed:@”fixedBackgroundImage”];
CALayer *backgroundImage = [CALayer layer];
backgroundImage.zPosition = 0;
[backgroundImage setFrame:CGRectMake(0, 0, 1024, 768)];
backgroundImage.contents = (id) backgroundImageSource.CGImage;
[self.view.layer addSublayer:backgroundImage];

Note: This code is built to fit an iPad screen. Take a look at the ‘1024, 768’ values if you would like to change the width and height of this CALayer.

Approved apps and updates can’t add/change screenshots

image

This has not happened to me thankfully but the more awareness the better.

So make sure you check your spelling and pick your screenshots for any new apps and updates wisely. Because Apple early this year disabled the ability to add/change your screenshots in your apps current version metadata.

Why? It was due to some App Store scammers changing the screenshots to other popular apps. Trying to push for more downloads.

Solution: I’m afraid to say if you find that you need to make changes to your screenshots. The only solution is adding a new version (update).

image

So just be careful.

Adding a custom selected UITabBarItem image in iOS7

image

It’s a little tricky to have the new UITabBarItem filled-in image style shown in the current iOS7 apps.

Xcode Storyboard doesn’t provide you with a field to add a highlighted image in the Attributes inspector. So you will need to use the following code inside your AppDelegate.m : didFinishLaunchingWithOption.

UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;
UITabBar *tabBar = tabBarController.tabBar;
UITabBarItem *tabBarItem1 = [tabBar.items objectAtIndex:0];
UITabBarItem *tabBarItem2 = [tabBar.items objectAtIndex:1];
UITabBarItem *tabBarItem3 = [tabBar.items objectAtIndex:2];
UITabBarItem *tabBarItem4 = [tabBar.items objectAtIndex:3];
tabBarItem1.selectedImage = [UIImage imageNamed:@”iconActionSelected”];
tabBarItem2.selectedImage = [UIImage imageNamed:@”iconEmotionSelected”];
tabBarItem3.selectedImage = [UIImage imageNamed:@”iconHereIAmSelected”];
tabBarItem4.selectedImage = [UIImage imageNamed:@”iconJumboSelected”];
return YES;

To learn how to design custom bar icons, see Bar Button Icons.