顯示具有 iOS 標籤的文章。 顯示所有文章
顯示具有 iOS 標籤的文章。 顯示所有文章

2011年7月23日 星期六

Vi Input Manager

0 意見
下載:http://www.corsofamily.net/jcorso/vi/


Vi Input Manager
by: Jason Corso
This bundle patches the Cocoa Text System to add a Vi-like command mode. After entering command-mode (typically, by hitting escape in Vi), ordinary Vi commands can be typed and the text field will be updated accordingly. Essentially, this add Vi command functionality (albeit a small subset) to any (and all) text editors that use the Cocoa text system; e.g., Safari, TeXShop, XCode, etc. Note, however, this does not work for other programs that do not use the Cocoa system.
All the text windows, will initialize in "input" mode (standard cocoa text input). You invoke the Vi-command window (exit the input mode) by hitting ` (the back-apostrophe key, this is customizable, see installation instructions) and then key in your favorite Vi commands. For example, move down a line 'j', move right 'l', delete two lines 'd2d', and so on. You enter back into "input" mode by typing the 'i'. You get the idea. Right now, you should be thinking -- "you mean the editor in XCode will behave like Vi?" Answer: Yes.

How do iOS programmers develop applications using Vim?

0 意見
原文出處:http://www.quora.com/Vim/How-do-iOS-programmers-develop-applications-using-Vim


  
How:
  1. Install macvim,
  2. Install cocoa.vim and snipMate.vim plugins by Michael Sanders.
  3. You'll still need to use xCode for a lot of things (find definition, , use Cmd-0 to toggle back to the xCode environment.
  4. get an app for dividing your screen quickly, i use left 2/3 for xcode and right 2/3 for macvim, with a 1/3 overlap in the middle on my laptop, otherwise 1/2 and 1/2 when plugged into a monitor.
  5. use : Ctl-x Ctl-o to for auto completion options
  6. if you get no match on your autoComplete on a method call using bracket syntax then try dot syntax for the correct auto complete
  7. Cmd-0 to toggle to xCode, Cmd-Shft-R to open console and Cmd-B to build to quickly do a build and see debug output
  8. Need to look up something quickly? Cmd-0 to toggle to Xcode, Cmd-Alt-Shft-? to open up xcode documentation window
  9. C-p to show local completion options (matches within currently open buffers)
  10. set macvim to open files in a new tab in same window
  11. set folding, nocompat, incsearch, virtualedit and other options in .vimrc according to your preference.

2011年7月20日 星期三

(Mac) 使用 Eclipse + TFS plugin 來做版本控制

0 意見
使用 Team Foundation Server 做版本控制的朋友,
如果在非 Windows 的環境下開發,
那麼要如何使用 TFS 版本控制的功能呢?

以 Mac OS 為例,我知道的有下面幾種方式:
1. Windows 以 Visual Studio 做版本控制,然後以 Shared Folder 的方式分享給 Mac OS 存取
2. SvnBridge 透過 SVN 做中介
3. Eclipse + TFS plugin 

目前我使用 3.,使用上覺得還蠻方便的,
對於在非 Windows 環境下開發,
且公司又是以 TFS 做版本控管的朋友應該是蠻方便的方式,
而且操作介面跟使用 Visual Studio 的選單完全一樣。

步驟:
1) 下載 eclipse-SDK-3.7-macosx-cocoa-x86_64.tar.gz
2) 下載 TFSEclipsePlugin-UpdateSiteArchive-10.1.0.zip
3) 解壓縮 Eclipse,開啟 Eclipse 主程式
4) Help -> Install New Software -> Add -> Archive 
然後選擇  TFSEclipsePlugin-UpdateSiteArchive-10.1.0.zip
在 Name 欄位任意輸入一個名稱:TFS Plugin
5) 將 Visual Studio  Team Explorer Everywhere 2010 打勾
6) 下面我有打勾的項目有
Show only the latest versions of available software
Group items by category
Show only software applicable to target environment
Contact all update sites during install to find required software
7) 按 Next 會開始安裝,接著就照步驟完成它
8) 安裝成功後會提示 restart Eclipse
9) Window -> Show View -> Other -> 選擇 Team Foundation Server -> Team Explorer
10) 按 Team Explorer 上面的+圖示,
I have read and accept the terms in the License Agreement -> Next -> 輸入 Product Key -> Next
11) 輸入 Server 位址, e.g. http://tfs.example.com:8080/tfs
12) 輸入 Username, Domain, Password
13) 然後 Next 選擇 Team Project

以上大功告成!Enjoy!






2011年6月25日 星期六

(iOS開發) 遇到 BAD_ACCESS 該怎麼辦?

0 意見
在開發 iPhone, iPad 程式時,
模擬器上執行有時會遇到 BAD_ACCESS 的訊息,
舉例來說,
將某一個物件的指標 release 之後,
卻想用 NSLog 來印出這個指標的內容,
此時就會出現 BAD_ACCESS 的訊息!

那麼,如何得到多一點的錯誤資訊來幫助我們 Debug 呢?

以 XCode 4 而言,

從 Product -> Edit Scheme -> Arguments

在Argument裡面加入這三個參數:
NSZombieEnabled YES
MallocStackLogging YES
MallocStackLoggingNoCompact YES

可以幫助我們得到多一點錯誤資訊!

2011年6月5日 星期日

VMware Player 安裝 Mac OS X 升級至 10.6.6 出現 The CPU has been disabled by the guest operating system. You will need to power off or reset the virtual machine at this point. 的解決方法!

0 意見
我的平台為:
Windows 7: 64bit
VMware Player: 3.1.4
CPU: Intel Core i3-2100 

當 Mac OS X 從10.6.5 升級到 10.6.6,
安裝完成 VMware 重新開機後,
畫面會一直停在蘋果畫面,
然後跳出一個警告訊息,
The CPU has been disabled by the guest operating system. You will need to power off or reset the virtual machine at this point. 

我試了許多種方法,
最後只有一個有效!
請在 .vmx 的最後一行加入:cpuid.1.eax = "0000:0000:0000:0001:0000:0110:1010:0101"

然後應該就可以正常執行了!

Reference url: 

2011年4月14日 星期四

[UILabel] 讓 UILabel 支援 Vertical alignment

0 意見
因為 iOS 上面的 UILabel 元件不支援 Vertical alignment (top, center, bottom)
那麼我們要怎麼做呢?
可以參考這個討論串:
http://discussions.apple.com/message.jspa?messageID=10270072#10270072

2011年4月11日 星期一

[UILabel] 在字數過多的時候,顯示「...」

0 意見
TableView在呈現資料時
我們可以自己設計想要的 TableViewCell 樣式
假設 Cell 裡面我們放置一個 UILabel 顯示資料
當字數過長時,想要用 ... 顯示
那該怎麼做呢?

可以在下面這個地方做一些處理
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;

處理如下(假設超過30個字要顯示...沒有特別考慮中文或英文的情況...單純舉例):

[UITableView] 修改 TableView 的 Section 之間的 Spacing

0 意見
當 TableView 的 Style 為 UITableViewStyleGrouped
就可以 Section 的形式來呈現資料
如果想要調整各 Section 之間的間隔
可以參考下面幾個函式進行修改:

2011年3月29日 星期二

[UITabBarController] 將TabbarController 隱藏

0 意見
TabbarController 
       |____ NavigationController
                            |_____________ViewController



當 NavigationController push 頁面後,
有些頁面可能想要隱藏下方的 Tab bar,
可以用下面的方式進行處理:


self.hidesBottomBarWhenPushed = YES;        
[self.navigationController pushViewController:ViewPage animated:YES];     
self.hidesBottomBarWhenPushed = NO;

2011年3月21日 星期一

[UITableView] 在 editing mode 選擇 Table cell 的作法

0 意見
在 TableView 的 instance 產生後,
可以將 allowsSelectionDuringEditing 這個 property 設為 YES,
這樣在 editing mode 就仍然可以讓 didSelectRowAtIndexPath 正常運作