Mobile device font resources
Water
|
11/25/2015
|

List of fonts that you will be useful when designing apps:

Apple San Franciso

San Francisco Compact is the font for Apple Watch.
San Francisco is the font for iOS after iOS 9.

https://developer.apple.com/fonts/

Android Roboto and Noto

Roboto is the latest system font after Android L (5.0).
Noto is the corresponding international font including traditional and simplified Chinese.

https://www.go

Continue Reading

CasperJS won't load https page
Water
|
10/20/2014
|

Recently I found that casperJS won't load https page as before, --ignore-ssl-errors flag is already set:

    casperjs --ignore-ssl-errors=yes file.js

It turns out that it caused by the recent SSLv3 vulnerability that SSLv3 transport is disabled in most web server, and phantomJS use SSLv3 by default. To fix it, add one more options:

    casperjs --ignore-ssl-errors=yes --ssl-protocol=tlsv1 file.j

Continue Reading

Create CATextLayer in iOS
Water
|
05/08/2014
|

It's a bit tricky th create a CATextLayer in iOS:

Firstly, remember to explicitly set the frame size of the layer:

CATextLayer *textLayer = [CATextLayer layer];
// set the string
textLayer.string = @"Hello world";
textLayer.foregroundColor = [UIColor blackColor].CGColor;
textLayer.frame = CGRectMake(0, 0, 100, 20);

Then you may wonder how to set the CFTypeRef type for font. Actually simply cast

Continue Reading

Checking iOS version
Water
|
04/15/2014
|

1. Compile-time checking OS version

_IPHONEOSVERSIONMAX_ALLOWED

This will check the maximum allowed OS version, that's the Base SDK version that the project is using. So we can include some code that feature is only available in newer SDK. But if we always assume coders are using newest version of SDK, this directive is rarely used.

#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_6_0
-(BOOL)s

Continue Reading

Adding webtrends framework crash the app
Water
|
04/11/2014
|

Try to add webtrends frameworks to one of my app. The framework request user to modify the app so that applicationDelegate should subclass webtrends' delegate. After the code is changed, the app crash right before the app launch:

    fwXXXXX[10818:60b] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<fwXXXXXAppDelegate 0xc574d90> setValue:forUndefinedKey:]:

Continue Reading