-
1 個附件
建立我的第一個Hello World程式碼問題
各位好(害羞扭扭)
我最近決定開始學習使用Xcode編寫iOS的程式(純粹興趣),
所以就買了這本看來很不賴的教學書 - “養成iOS7 程式設計的30堂課”
http://www.books.com.tw/products/0010631088?loc=003_002
如果有人也是從這本書起步的請快幫幫我吧(omg)
在第18頁的地方教到了在Hello World的按鈕中加上程式碼的部分,而寫了這段語言:
- (IBAction)showmessage
{
UIAlertView *helloWorldAlert = [[[UIAlertView alloc]]
initWithTitle:*"My First App" message:*"Hello, World!" delegate:nil
cancleButtonTitle:*"OK" otherButtonTitles:nil];
//Display the Hello World Message
[helloWorldAlert show];
}
*end
但 UIAlertView *helloWorldAlert = [[[UIAlertView alloc]] 這段總是被Xcode用紅框起來表示未知的程式指令,
可是我再怎麼檢查和爬文都跟大部份的人寫的一樣啊?!
我檢查了好久也弄不清所以然......,只好來這裡向各位求助了TT...
抱歉 為了這件小小事而擾民了(印堂發黑) (新手請多指教!!
-
UIAlertView *helloworldalert = [[UIAlertView alloc]initWithTitle:*"My First App" message:*"Hello, World!" delegate:nil cancelButtonTitle:*"OK" otherButtonTitles:nil, nil];
中括號有誤,另外inittitle的格式也有誤。
-
儘量使用自動完成比較不容易錯,游標在結束括號左右移動他會幫你標示對應的起始括號。
-