2013年7月19日 星期五

移除所有 .svn

真的覺得svn不是很好用,
想要移除svn時控管時,
必須要刪除所有資料夾下的.svn,
但是資料夾多的時候真的會刪到手軟。

在Mac 終端機中,先切換到專案資料夾,
然後輸入:
find . -name ".svn" -exec rm -rf {} \; 
這樣就能刪光光啦!

2013年6月21日 星期五

錯誤訊息:
Finishing up a navigation transition in an unexpected state. Navigation Bar subview tree might get corrupted.

原來手腳太快也是會有問題的,
在使用navigation時,要注意push的間隔,
如果在很短的時間連續push就會發生上述錯誤,
這時候記得延遲一下就可以解決這問題的。

可以用這個來解決:
// 在原先要push的地方加上,取代原先的push
[self performSelector:@selector(showView) withObject:nil afterDelay:0.7];

// Push View
- (void)showView{

    UIViewController *viewController = [[UIViewController alloc] initWithNibName:@"UIViewController" bundle:nil];
    [self.navigationController pushViewController:viewController animated:YES];
}
參考文件:
http://www.cocoachina.com/bbs/read.php?tid=110206

2013年6月17日 星期一

Debug Area Commands

在Debug Area中可以輸入help後,列出的Commands有以下這些,
不過我認為應該是不只啦!先記錄下來。
後面有找到在另外補充。

The following is a list of built-in, permanent debugger commands:

_regexp-attach    -- Attach to a process id if in decimal, otherwise treat the
                     argument as a process name to attach to.
_regexp-break     -- Set a breakpoint using a regular expression to specify the
                     location, where  is in decimal and 
is in hex. _regexp-bt -- Show a backtrace. An optional argument is accepted; if that argument is a number, it specifies the number of frames to display. If that argument is 'all', full backtraces of all threads are displayed. _regexp-display -- Add an expression evaluation stop-hook. _regexp-down -- Go down "n" frames in the stack (1 frame by default). _regexp-tbreak -- Set a one shot breakpoint using a regular expression to specify the location, where is in decimal and
is in hex. _regexp-undisplay -- Remove an expression evaluation stop-hook. _regexp-up -- Go up "n" frames in the stack (1 frame by default). apropos -- Find a list of debugger commands related to a particular word/subject. breakpoint -- A set of commands for operating on breakpoints. Also see _regexp-break. command -- A set of commands for managing or customizing the debugger commands. disassemble -- Disassemble bytes in the current function, or elsewhere in the executable program as specified by the user. expression -- Evaluate a C/ObjC/C++ expression in the current program context, using user defined variables and variables currently in scope. frame -- A set of commands for operating on the current thread's frames. gdb-remote -- Connect to a remote GDB server. If no hostname is provided, localhost is assumed. help -- Show a list of all debugger commands, or give details about specific commands. kdp-remote -- Connect to a remote KDP server. udp port 41139 is the default port number. log -- A set of commands for operating on logs. memory -- A set of commands for operating on memory. platform -- A set of commands to manage and create platforms. plugin -- A set of commands for managing or customizing plugin commands. process -- A set of commands for operating on a process. quit -- Quit out of the LLDB debugger. register -- A set of commands to access thread registers. script -- Pass an expression to the script interpreter for evaluation and return the results. Drop into the interactive interpreter if no expression is given. settings -- A set of commands for manipulating internal settable debugger variables. source -- A set of commands for accessing source file information target -- A set of commands for operating on debugger targets. thread -- A set of commands for operating on one or more threads within a running process. type -- A set of commands for operating on the type system version -- Show version of LLDB debugger. watchpoint -- A set of commands for operating on watchpoints. For more information on any particular command, try 'help '.

iOS 6 Status Bar Color

在iOS 6,Status Bar的顏色會改變,
原來是受到了Navigation Bar顏色的影響,
之前都沒有注意到這個狀況。

這是為了讓App與整體更加融合,
不過話說回來這功能有時候也是會挺困擾的。
調整的方式如下:
在這邊改變一下設定就行啦!
如果是Default,在iOS 6系統會自動變更Status Bar顏色,iOS 6以下版本則不會。
附上相關程式設定
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];

參考資料:
http://blog.jiwo.in/post/28621527054
http://stackoverflow.com/questions/12931749/status-bar-color-in-ios-6

2013年6月11日 星期二

Multi Thread 散記

UI更新必須在主線程
很多文章使用detachNewThreadSelector或performSelectorInBackground啓動Thread,
然後呼叫performSelectorOnMainThread,通知主線程更新UI。
// 主線程呼叫
[self performSelectorInBackground:<#(SEL)#> withObject:<#(id)#>];
[NSThread detachNewThreadSelector:<#(SEL)#> toTarget:<#(id)#> withObject:<#(id)#>];
// 更新UI
[self performSelectorOnMainThread:<#(SEL)#> withObject:<#(id)#> waitUntilDone:<#(BOOL)#>];

使用NSOperationQueue的過程:
  1. 建立一个NSOperationQueue的實體 
  2. 建立一个NSOperation的實體 
  3. 將operation加入到NSOperationQueue中 
  4. release掉operation

2013年6月5日 星期三

2013年5月29日 星期三

XCode Snippets

一直以為XCode是沒有提供Snippets的,
沒想到搜尋發現,錯很大啊!

這是Youtube搜尋到的教學,
沒想到竟然如此簡單啊!

另外紀錄一下Snippets存放的路經,
方便日後備份
~/Library/Developer/Xcode/UserData/CodeSnippets

PS:我XCode 版本是4.6.2,比較舊的版本路徑可能會有些不同要注意噢!

=== 補充 ===
補上自制Snippets Sync相關路徑,這是透過Dropbox的方式。
http://stackoverflow.com/questions/5261076/how-can-one-transfer-xcode-4-code-snippets-from-one-machine-to-another