我無法在任何地方找到它。我不想每次都使用調試器。如何在iPhone上獲取打印消息。Iphone彈出提醒消息
17
A
回答
41
使用的NSLog功能:
NSLog(@"Your message here.");
// with parameters:
NSString * myParam = @"Some value";
NSLog(@"myParam:%@", myParam);
這些消息被寫入到控制檯日誌。您可以在模擬器上運行Console.app或通過切換到的XCode調試器/控制檯視圖(XCode -> Run -> Console)
查看他們,如果你真的想做一個彈出警報(如JavaScript的alert()
功能),你可以這樣做:
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Message"
message:@"This is a sample"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
[alert release];
1
使用Google或Xcode文檔查看器查找UIAlertView
。
3
UIAlertView* alert;
alert = [[UIAlertView alloc] initWithTitle:@"Info" message:@"Much more info" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[alert release];
4
// open a alert with an OK and cancel button UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"UIAlertView" message:@"My message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil]; [alert show]; [alert release];
樣品圖片:
+0
就像一個魅力。 UPVOTED! :) – 2013-05-17 16:55:39
+0
謝謝託尼吉爾 – 2014-06-18 13:38:21
相關問題
- 1. 提醒彈出消息,當我點擊提交
- 2. 聊天消息提醒,如Gmail提醒
- 3. 彈出所有選項卡的提醒消息
- 4. Appium - 彈出式提醒消息沒有被拒絕
- 5. 提示消息不彈出
- 6. 通知消息/提醒消息和UICollectionView:
- 7. 雙重提醒消息
- 8. JavaScript提醒錯誤消息
- 9. Foundation_6提醒消息content_tag
- 10. JSON編碼提醒消息
- 11. 「呼叫」提醒彈出?
- 12. 彈出提醒vb 6
- 13. 彈出消息
- 14. 在Extjs中提示提醒消息框
- 15. 提交後彈出成功消息
- 16. MVC表單提交的彈出消息
- 17. 如何在android中設置提醒,並在屏幕上彈出消息?
- 18. 整個頁面彈出的消息將根據提醒進行激活
- 19. iPhone + In App購買+訪問提醒消息按鈕
- 20. 推送通知,iPhone上未收到提醒消息
- 21. iPhone + In App購買+更改提醒消息
- 22. SSRS - 彈出消息
- 23. Yiiframework消息彈出
- 24. 彈出消息框
- 25. Android彈出消息
- 26. JQuery彈出消息
- 27. 彈出新消息
- 28. 在iPhone提醒對話框上彈出多個鍵盤?
- 29. 什麼是iPhone鈴聲提醒彈出名稱?
- 30. 當出現消息框時發出提醒visual studio 2010
僅供參考UIAlertView中現在已經過時,與iOS 8 – 2015-02-13 00:15:58
的例子,如何用新的''UIAlertController一個可以代替'UIAlertView'在這裏找到:http://useyourloaf.com/blog/2014/09/05/uialertcontroller-changes-in-ios-8.html – andi 2015-08-08 15:19:52
或官方文檔:https:// developer .apple.com/library/ios/documentation/UIKit/Reference/UIAlertController_class/index.html#// apple_ref/occ/cl/UIAlertController – andi 2015-08-08 15:30:24