Using iOS 7 text to speech
Water
|
02/05/2014
|

iOS 7 provides powerful text to speech (TTS) support. Here is a simple example:

NSString *language = @"zh-HK";    // set language, zh-HK will speak cantonese
NSString *string = @"你好嗎";
AVSpeechSynthesizer *synthesizer = [[AVSpeechSynthesizer alloc]init];
AVSpeechUtterance *utterance = [AVSpeechUtterance speechUtteranceWithString:string];
utterance.rate = AVSpeechUtteranceDefaultSpeechRate;
uttera

Continue Reading

XCode4TemplateForXCode5
Water
|
01/28/2014
|

In Xcode 5, the default project template will create a new project using storyboard and use new API for iOS 7 only.

This repo ported older project under Xcode 4 to Xcode 5, so that you can easily create project that supports both iOS 6 and iOS 7. It is useful if you want to:

  1. Using xib instead of storyboard.
  2. Support both iOS 6 and iOS 7.

Installation

Copy "XC4 Installation" folder in this repo t

Continue Reading

Suppress ".. is deprecated" warning in code block
Water
|
01/28/2014
|
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void) methodUsingDeprecatedStuff {
    //use deprecated stuff
}
#pragma clang diagnostic pop
drawInRect:withAttributes: in iOS 7 and iOS 6.1
Water
|
01/20/2014
|

iOS 7 comes with a new method in NSString for drawing text:

drawInRect:withAttributes:

However if you try to test and use the API using:

if ([string respondsToSelector: @selector(drawInRect:withAttributes:)])

You thing it should work, but actually it will crash on iOS 6.1. It is because the method was already existed in iOS 6.1 as hidden API. And it seems the parameters are different and so th

Continue Reading

Moto G vs 紅米
Water
|
01/15/2014
|

今天終於有 Moto G 行版消息,以下是兩部平價 Android 機比較:

型號 紅米 Moto G
價錢 $999 $1898
OS 4.2 MIUI 4.3 (可升級 4.4)
呎吋 137 x 69 x 9.9 mm 129.9 x 65.9 x 11.6 mm
重量 158g 143 g
CPU Mediatek MT6589T Quad-core 1.5 GHz Qualcomm Snapdragon 400 1.2GHz quad-core
GPU PowerVR SGX544 Adreno 305
Quadrant Benchmark 4748 8082
RAM 1GB 1GB
ROM 4GB 16GB
存儲擴展 有 (最大32GB) 沒有
藍牙 3.0HS 4.0
LTE 沒有 沒有
SIM SIM Micro

Continue Reading