Saturday, April 6, 2013

Create ellipse shape and set color by delegate

Here's a way to create ellipse shape and use delegate to set what color the ellipse shape is.

In my app "Money42",it's has a switch button to set who pay the money.

When the switch button init,it will use delegate to set color itself.

The delegate method is only do one thing,that's return a color NSArray from NSUserDefaults which we set before.

Wednesday, April 3, 2013

Core Data Relationship and Relationship Delete Rules

If your data model is complex,you could need to set Core Data Relationship,

Take my App "FrozenTime" for example,It need to set two entity(Album and Photo).

Album and Photo is One-to-Many Relationships.

The red rectangle area is the "One-to-Many Relationships" look like.

Wednesday, March 13, 2013

How to loop a sound effect by SimpleAudioEngine

Recently,I wrote a game which need loop a sound effect,
but SimpleAudioEngine can't do that,
so I add a methon in SimpleAudioEngine.
If you need to do the same thing check out the code below...

Sunday, March 3, 2013

How to convert MP3 to CAF

If you try to make a game by Cocos2D,you may use some sounds in your game and many books will suggest to use CAF.

It's simple things.You don't need to buy any Software,You just need to use iTunes do this thing. (or Terminal)

Friday, March 1, 2013

How to autocomplete image name and show color selector in Xcode

Xcode is not Humanized to set UIIImage name and choose color.
Here is two tool for helping you do those thing fast.
The two tools is KSImageNamed-Xcode and ColorSense for Xcode.

Sunday, September 23, 2012

iOS 6.0 Orientation

In iOS6,UINavigation Controller does not consult their children to determine whether they should autorotate.In another word iOS6 handle orientation by top-most controller.

The shouldAutorotateToInterfaceOrientation: method of UIViewController is deprecated. In its place, you should use the supportedInterfaceOrientations and shouldAutorotate methods.

iOS6 has three new method to handle orientation
// what we support
- (NSUInteger)supportedInterfaceOrientations 
    return UIInterfaceOrientationMaskAllButUpsideDown;

// should autorotate or not
- (BOOL) shouldAutorotate 
    return YES;

//initial orientation we want to have
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
    return UIInterfaceOrientationPortrait;
But where should we write those methods?