2013年6月5日星期三

Using block with self api and avoids the retain cycle


      I'm leaving Beijing to Hangzhou, and join Alibaba wireless department now. Currently involved in a new product with a workmate.
      The project's iOS Deployment Target is iOS 5.0, so we begin to use ARC happily. Before this project, I always use MRC instead. And after learning changes between ARC and MRC we set off.
      But yesterday we found we seemed to have retain cycle in our project, and my first idea was this may have relation with using self api in block. Then I googled it, and found solution in StackOverflow here. Please check it out.



------

My new business with my wife, wholesale meddle-to-high end men's seamless underwear in the Netherlands: https://ecosharelife.com

Using customized font in iOS, some thing to be noticed


1,add Font lib (.ttf or .odf) into Xcode Project,like FZKATJW.TTF (FangzhengKatong lib)。
2,add 'Fonts provided by application' in info.plist (and set item0's value as FZKATJW.TTF, add other font libs like this as well. Notice,suffix like .ttf or .otf should be added too).
3,Using the following code to print out the 'FontName' of the font we added in iOS runtime.
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
    NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
    fontNames = [[NSArray alloc] initWithArray:[UIFont fontNamesForFamilyName:[familyNames objectAtIndex:indFamily]]];
    for (indFont=0; indFont<[fontNames count]; ++indFont)
    {
        NSLog(@"    Font name: %@", [fontNames objectAtIndex:indFont]);
    }
}
In my case the print info is like this:
2013-05-22 09:26:44.749 taobao4baby[502:c07] Family name: FZKaTong-M19S
2013-05-22 09:26:44.749 taobao4baby[502:c07] -Font name: FZKATJW--GB1-0
So we using the font with this code:
[UIFont fontWithName:@"FZKATJW--GB1-0" size:16]
Now you can using the new customized font freely~



------

My new business with my wife, wholesale meddle-to-high end men's seamless underwear in the Netherlands: https://ecosharelife.com