Here is an old(2013,not so old) article which described why the author don’t use Interface Builder, I can’t agree more about this.Here is the summary I made about the article:

  • Choosing Explicit over Implicit.
    Just like he mentioned, there was a time I spend 2 hours to search in the workspace, to solve a runtime errorlibc++abi.dylib: terminate_handler unexpectedly threw an exception

and finally I found, I linked the UILabel to the file twice.

  • Tight Coupling. I rarely met a open source lib was structured depends on IB, I think it’s a convention amount developers, because it will be horrible if you need to keep the lib trendy up to the newest official API.(Their genius change the xib format randomly maybe)
  • Working With Others, yep, nothing could be worse than modify styles in a xib with 20+ layers, and the original author disappeared 3 months ago.
  • It’s Part of Xcode, It’s ok for me, because all the apple development cycle is enclosed, maybe I will try some 3rd part IDE, but I still insist to use the original one.
  • AutoLayout, I admit it brings me some benefits, but also some maddening problems, one day my partner changed something on a xib file, and all my layout were ruined, I was about to attend  a class, for that, I had to cancel the class, and cast another 1 hour to figure it out.
    But this is the situation I am facing, there is a guy in our team who really love to use IB, and he like to use a xib file for each ViewController(such a fucking old style). The worse thing is, he built up all the structure, it become really hard to change when I joined in the project!

Some tips:

Use custom fonts

Source Link

1. Drag the fonts file into your project.

2. Make sure that they’re included in the target,(this is the point stuck me)

3. Include your iOS custom fonts in your application plist, it’s in “Supporting Files group”, find out [appname]-Info.plist, add a row called “Fonts provided by application”, then add your custom font file name.

4. Find the font name, I’d tried to find a convenient way to make it, but you still needs to do like this:

for (NSString* family in [UIFont familyNames])
{
    NSLog(@"%@", family);

    for (NSString* name in [UIFont fontNamesForFamilyName: family])
    {
        NSLog(@"  %@", name);
    }
}

Then find out row by row -_-# , IT IS SUCKED!

Don’t expect the name will lay in your right click menu.

5. The latest thing to do is using the font to your UILabel.

UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, 80)];
label.textAlignment = NSTextAlignmentCenter;
label.text = @"Yeah!";
label.font = [UIFont fontWithName:@"TradeGothicLTCom-BdCn20" size:60];
[self.view addSubview:label];
Display integer in two bits

Don’t know how to say that, just want to display a integer “8” –> “08”,Don’t forget the DOT.

NSLog(@"%.2d",9); //—> 09
NSLog(@"%2d",9); //—> 9