Singleton or Class methods
.
Saturday, December 22, 2012
Thursday, December 20, 2012
Customise the BackBarButtonItem
Customizing the BackBarButtonItem
How can I show a custom image in navigation bar back button instead of default buttons which are shown by nav bar itself
iphone - Custom UIBarButtonItem for back button
How to create backBarButtomItem with custom view for a UINavigationController
.
How can I show a custom image in navigation bar back button instead of default buttons which are shown by nav bar itself
iphone - Custom UIBarButtonItem for back button
How to create backBarButtomItem with custom view for a UINavigationController
.
Thursday, December 6, 2012
Wednesday, November 28, 2012
Tuesday, November 20, 2012
Thursday, November 8, 2012
Wednesday, November 7, 2012
iPhone的檔案系統
iPhone的檔案系統
<程式根目錄>
<程式根目錄>
- 我的程式.app (程式的主要資料夾,只能讀取)
- 我的程式
- MainWindow.xib
- 其他在Xcode中所加入的Resources
- Documents
- Library
- Cache
- Preference
// 基本的目錄 NSString *homePath = NSHomeDirectory(); // 根目錄 NSString *tmpPath = NSTemporaryDirectory(); // 暫存目錄 // Documents 資料夾 NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsPath = [paths objectAtIndex:0]; // <程式根目錄>/Documents/foo.plist NSString *fooPath = [documentsPath stringByAppendingPathComponent:@“foo.plist”];
.
Tuesday, November 6, 2012
Monday, November 5, 2012
plist 和 Core Data 比較
plist 和 Core Data 比較
plist 是寫入檔案
優點:
- 方便(method簡單)
- 小資料量時快速
- 適合1kb以下資料
缺點:
- 一次必須寫入整份檔案
- 無法處理 table 間的關係(relationship)
.
plist 是寫入檔案
優點:
- 方便(method簡單)
- 小資料量時快速
- 適合1kb以下資料
缺點:
- 一次必須寫入整份檔案
- 無法處理 table 間的關係(relationship)
.
Monday, October 29, 2012
Friday, October 19, 2012
iOS 資料保存 Data Persistence - NSUserDefaults
NSUserDefaults (Setting)
Property List (plist)
CoreData
.
Property List (plist)
CoreData
- - (void)applicationDidEnterBackground:(UIApplication *)application
- {
- NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
- [userDefault setObject:@"白彼得" forKey:@"name"];
- [userDefault synchronize];
- }
- - (void)applicationWillEnterForeground:(UIApplication *)application
- {
- NSString *name = [[NSUserDefaults standardUserDefaults] objectForKey:@"name"];
- NSLog(@"name %@", name);
- }
.
Thursday, October 18, 2012
iOS 資料保存 Data Persistence - Property List
NSUserDefaults (Setting)
Property List (plist)
CoreData
------------------------------------
iOS檔案位置管理:
專案附檔的都放在專案下
動態產生的都放在模擬器(實機)底下
好處:
1.專案附檔的plist有UI介面可以方便管理
2.由writeToFile:atomically寫出Property List
名詞解釋:
property list: 一種xml的資料格式
writeToFile: 寫檔動作,儲存plist到模擬器document資料夾的動作
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); : 模擬器/實機 的document資料夾位置
NSPropertyListSerialization: coverts Property List to/from NSData
iPhone 開發教學 - 使用 Property List 和 SQLite 處理資料儲存
(重要!教檔案位置,讀寫檔基本指令。)
Introduction to Property Lists (Apple Official)
相關指令 //codes are from 彼得潘app教學書
讀取專案裡附的檔案 (除圖片之外,如 txt 檔或影音檔)
讀取儲存動態產生的檔案(document底下位置)
非特權物件的寫檔
keyword:
encodeObject, decodeObjectForKey 是物件裡面的encode實作
[NSKeyedArchiver archiveRootObject: toFile:];
[NSKeyedUnArchiver unarchiveObjectWithFile:];
非特權物件的寫檔 (使用arhiver)
用NSMutableData *data來當作archiver,然後用writeToFile寫檔
特權物件可以直接用WriteToFile寫檔(只有NSString, NSData, NSDictionary, NSArray可以),而非特權物件需要先archive才可以寫檔。
.
Property List (plist)
CoreData
------------------------------------
iOS檔案位置管理:
專案附檔的都放在專案下
動態產生的都放在模擬器(實機)底下
好處:
1.專案附檔的plist有UI介面可以方便管理
2.由writeToFile:atomically寫出Property List
名詞解釋:
property list: 一種xml的資料格式
writeToFile: 寫檔動作,儲存plist到模擬器document資料夾的動作
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); : 模擬器/實機 的document資料夾位置
NSPropertyListSerialization: coverts Property List to/from NSData
iPhone 開發教學 - 使用 Property List 和 SQLite 處理資料儲存
(重要!教檔案位置,讀寫檔基本指令。)
Introduction to Property Lists (Apple Official)
相關指令 //codes are from 彼得潘app教學書
讀取專案裡附的檔案 (除圖片之外,如 txt 檔或影音檔)
讀取儲存動態產生的檔案(document底下位置)
非特權物件的寫檔
keyword:
encodeObject, decodeObjectForKey 是物件裡面的encode實作
[NSKeyedArchiver archiveRootObject: toFile:];
[NSKeyedUnArchiver unarchiveObjectWithFile:];
非特權物件的寫檔 (使用arhiver)
用NSMutableData *data來當作archiver,然後用writeToFile寫檔
用法:
// Writing
- (BOOL)writeToFile:(NSString *)aPath atomically:(BOOL)flag;
- (BOOL)writeToURL:(NSURL *)aURL atomically:(BOOL)flag;
// Reading
- (id)initWithContentsOfFile:(NSString *)aPath;
- (id)initWithContentsOfURL:(NSURL *)aURL;
- (BOOL)writeToFile:(NSString *)aPath atomically:(BOOL)flag;
- (BOOL)writeToURL:(NSURL *)aURL atomically:(BOOL)flag;
// Reading
- (id)initWithContentsOfFile:(NSString *)aPath;
- (id)initWithContentsOfURL:(NSURL *)aURL;
特權物件可以直接用WriteToFile寫檔(只有NSString, NSData, NSDictionary, NSArray可以),而非特權物件需要先archive才可以寫檔。
.
Differences between property list, NSUserDefaults
how to save plist to NSUserDefaults
"You can think of
However, how you choose between
.
"You can think of
NSUserDefaults
as an invisible .plist
that you can read and write to, without ever being able to actually see the file. Using NSUserDefaults
, you will be able to restore saved values even if the app has been killed in multitasking.However, how you choose between
.plist
and NSUserDefaults
should be based off of how much data you need to save. Apple recommends only saving small amounts of data to NSUserDefaults
. If you need to save a lot of information then .plist
is the way to go. Either that or of course Core-Data
.".
Wednesday, October 17, 2012
World Resourse
Mail List
Cocoa-dev
Xcode-users
Quartz-dev
Cocoa-unbound
iPhone SDK Development
Forum
iphonedevbook.com
Apple Developer Forums
Apple Discussions, Developer Forums
Apple Discussions, iPhone
Website
CocoaHeads
NSCoder Night
Stack Overflow
iDeveloper TV
Cocoa Controls
Blog
Wil Shipley
Wolf Rentzsch
iDevBlogADay
CocoaCast
ObjecticeC on Twitter
Mike Ash
Meeting
WWDC
MacTech
NSConference
360 iDev
iPhone/iPad DevCon
Cingleton
Voices That Matter
CocoaConf
.
Cocoa-dev
Xcode-users
Quartz-dev
Cocoa-unbound
iPhone SDK Development
Forum
iphonedevbook.com
Apple Developer Forums
Apple Discussions, Developer Forums
Apple Discussions, iPhone
Website
CocoaHeads
NSCoder Night
Stack Overflow
iDeveloper TV
Cocoa Controls
Blog
Wil Shipley
Wolf Rentzsch
iDevBlogADay
CocoaCast
ObjecticeC on Twitter
Mike Ash
Meeting
WWDC
MacTech
NSConference
360 iDev
iPhone/iPad DevCon
Cingleton
Voices That Matter
CocoaConf
.
Tuesday, October 16, 2012
ECSlidingViewController
# ECSlidingViewController
`ECSlidingViewController` is a view controller container for iOS that presents its child view controllers in two layers. It provides functionality for sliding the top view to reveal the views underneath it. This functionality is inspired by the Path 2.0 and Facebook iPhone apps.
ECSlidingViewController Demo from EdgeCase on Vimeo.
This project is an example app that showcases the uses for `ECSlidingViewController`.
ECSlidingViewController Demo from EdgeCase on Vimeo.
This project is an example app that showcases the uses for `ECSlidingViewController`.
Friday, October 12, 2012
Books 好書
iOS 5 Programming Pushing the Limits, 2/e : Developing Extraordinary Mobile Apps for Apple iPhone, iPad, and iPod Touch (Paperback)
amazon五顆星20人
iOS Programming: The Big Nerd Ranch Guide, 3/e (Paperback)
amazon五顆星39人
Pro iOS Apps Performance Optimization (Professional Apress)
amazon五顆星2人
The iOS 5 Developer's Cookbook: Core Concepts and Essential Recipes for iOS Programmers (3rd Edition) (Developer's Library)
iOS SDK 開發範例大全 (The iOS 5 Developer's Cookbook: Core Concepts and Essential Recipes for
iOS Programmers, 3/e)
amazon五顆星7人
越獄女神的書
Beginning iOS 5 Development: Exploring the iOS SDK
探索iOS 5程式開發實戰
amazon五顆星8人
.
Thursday, October 11, 2012
Monday, September 24, 2012
Sunday, September 23, 2012
Tuesday, September 18, 2012
Monday, September 17, 2012
Thursday, September 13, 2012
Wednesday, September 12, 2012
Tuesday, September 11, 2012
协议与委托(Protocol and Delegate)实例解析
协议与委托(Protocol and Delegate)实例解析
"2 委托:
委托是objC中使用非常频繁的一种设计模式,它的实现与协议的使用是分不开的,让我们看一个综合示例:
小公司老板日常的工作是管理公司、教导新员工、发工资与接电话。
其中管理公司、教导新员工是老板要亲为的。
而发工资与接电话老板希望招聘一个秘书来帮忙,于是对秘书的要求就是要略懂出纳发工资,要能帮助领导接电话。 而这两项要求便是协议,对类功能的限定。"
.
Monday, September 10, 2012
Android與 iPhone
Android與 iPhone:南轅北轍的開發理念
新一代手機開發iPhone vs. Android (附多個文章)
“說實在的,我一直認為Apple和Google對於手機開發的心態十分不同,Apple是非常努力的在手機軟體平台上整合,在這上面賺到錢,並且讓參與的工程師或廠商能賺得到錢。Google呢?開放過了頭,Android是開放原始碼沒錯,但也不見到有受益很多在消費者身上,反而是讓之前沒作手機的,或有代工手機硬體的廠商,甚至是有錢電信公司,免費得到原來授權價格不菲的手機作業系統,然後也投入手機市場大戰一翻。當然,Google的目的只是要延申他在網際網路的應用軟體優勢到行動上網的領域中,至於能不能從Android上賺到錢,就不是那麼在乎了,只要他的優勢能存在或延申,股價當然還是會維持本夢比的水準。Android的SDK我認為更新得太快、太亂、太有Google的個人色彩,每次大改版幾乎都是配合Google的新服務或新功能所量身打造,另一方面,Android手機如雨後春筍般的不斷有新機上市,一堆電信公司、電腦公司…都努力的出新版的Android手機,便宜的、高規格的、有改的、沒改過的、山寨的…那又如何?不同的手機硬體、螢幕規格、OS版本,代表開發廠商或設計師,又得為不同的硬體修改軟體介面或功能,尤其是必定會用到顯示規格和聲光效果的遊戲軟體。”
.
Delegate/Data Source和Controller
Delegate/Data Source和Controller(一)
Delegate/Data Source和Controller(二)
了解嗎?還是有點模糊?我的理解是Controller是在於MVC設計模式中的C這個角色,扮演Model和View的居中協調者的工作。當然ViewController的工作就是針對視圖的控制器工作,管理視圖,例如在需要的時候載入它到記憶體中,不需要時在記憶體中釋放它。要記得在iPhone OS中,通常一個視圖只會有一個視圖控制器。
A delegate is a protocol (interface) that defines methods that an object implements in order to receive specific messages from other objects. Delegates objects are most often used to receive asynchronous callbacks such as user input, I/O.
委記是一個協定(介面),定義了許多物件可以實作的方法,為了接收來自其他物件的特定訊息。委託物件經常使用於接收非同步的回應呼叫,例如使用者輸入或I/O。
A controller is an object that usually contains UI elements (views, controls, etc.) and data, and both receives and send messages to the various objects within it. In many cases, a controller is a delegate and can implement several delegate protocols to receive events from multiple objects.
控制器是一個物件,通常其中包含UI元素(視圖、控制器…等)和資料,以及接收和傳送兩種訊息到其中的眾多物件。在大部份時候,控制器是一個委託且可以實作各種委託協定,以便可以接收來自多個物件的事件。
而Delegate/data source是另一種實作事件控制的模式,也是位於MVC中C這個位置的機制,只是因為它是利用協定而非一般的子類別繼承實體而來,變成另一類處理控制的機制。但是,這兩種並不會是衝突或只能擇一使用,在很多情況下,反而是兩種都要搭配使用才能完成所需的工作。”
.
Introduction to Coding Guidelines for Cocoa
“Code Naming Basics”
“Naming Methods”
“Naming Functions”
“Naming Properties and Data Types”
“Acceptable Abbreviations and Acronyms”
.
Friday, September 7, 2012
Monday, September 3, 2012
Fine Apps
Clear
songza
Remember The Milk
note book
.
clear to do list
social magzine
work progress arrangment
simple notes
.
songza
Remember The Milk
note book
.
Subscribe to:
Posts (Atom)