2009-10-01 16 views

答えて

41

はのNSLog関数を使用してください:

NSLog(@"Your message here."); 
// with parameters: 
NSString * myParam = @"Some value"; 
NSLog(@"myParam:%@", myParam); 

メッセージがコンソールログに書き込まれます。あなたは本当にあなたが行うことができます(JavaScriptのalert()機能など)のポップアップアラートを行いたい場合は、Console.appを実行するか、デバッガ/コンソールビュー(XCode -> Run -> Console)

にはXCodeを切り替えることで、シミュレータでそれらを表示することができます。

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Test Message" 
                message:@"This is a sample" 
               delegate:nil 
             cancelButtonTitle:@"OK" 
             otherButtonTitles:nil]; 
[alert show]; 
[alert release]; 
+2

はFYI UIAlertViewは今、どのように新しい 'UIAlertController' 1缶で 'UIAlertView'を置き換えるためのiOSでの8 –

+1

例を推奨されていませんhttp://useyourloaf.com/blog/2014/09/05/uialertcontroller-changes-in-ios-8.html – andi

+0

または公式ドキュメント:https:// developerをご覧ください。 .apple.com/library/ios/documentation/UIKit/Reference/UIAlertController_class/index.html#// apple_ref/occ/cl/UIAlertController – andi

1

UIAlertViewは、GoogleまたはXcodeドキュメントビューアで検索してください。

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]; 

サンプル画像:

enter image description here

+0

はチャームのように機能します。更新されました! :) –

+0

ありがとうトニーギル –

関連する問題