Saturday, September 20, 2014

Premultiplied Alpha

private let bitmapInfo:CGBitmapInfo = CGBitmapInfo(CGImageAlphaInfo.PremultipliedFirst.toRaw())
enum CGImageAlphaInfo : UInt32 {
    case None /* For example, RGB. */
    case PremultipliedLast /* For example, premultiplied RGBA */
    case PremultipliedFirst /* For example, premultiplied ARGB */
    case Last /* For example, non-premultiplied RGBA */
    case First /* For example, non-premultiplied ARGB */
    case NoneSkipLast /* For example, RBGX. */
    case NoneSkipFirst /* For example, XRGB. */
    case Only /* No color data, alpha data only */


Wednesday, September 17, 2014

Image Dump using Swift

所以用 Swift 寫寫圖片相關的東西了解運作也是很正常的。

回到主題,之前是因為看到有人用 Objective-C 寫了一個 Image Dump,
而最近因為寫一個簡報,就順手改寫了個 Swift 的版本,

Thursday, May 22, 2014

Use Automator export @2x image

Set Xcode Framework Search Path

Sometimes when you pull project from your friend, but xcode tell you that can't find Framework. You need set xcode framework search path $(SRCROOT) and it can solve problem.

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.