差分
ナビゲーションに移動
検索に移動
==iOS 8以降==
iOS8以降ではUIAlertControllerを使えとのこと。
<source lang="csharp">
var alert = UIAlertController.Create("title", "message", UIAlertControllerStyle.Alert);
alert.AddAction(UIAlertAction.Create("NO", UIAlertActionStyle.Cancel , (handler) => {
Console.WriteLine("NO");
}));
alert.AddAction(UIAlertAction.Create("YES", UIAlertActionStyle.Default, (handler) => {
Console.WriteLine("YES: " + alert.TextFields[0].Text);
}));
alert.AddTextField((textfield) => {
textfield.Placeholder = "textfield";
//
var label = new UILabel(new CGRect(0, 0, 80, 30));
label.Text = "LABEL: ";
textfield.LeftView = label;
textfield.LeftViewMode = UITextFieldViewMode.Always;
});
this.PresentViewController(alert, animated: true, completionHandler: null);
</source>
ボタンのフォントを以下の3つの中から選ぶことができる。
* UIAlertActionStyle.Default:標準
* UIAlertActionStyle.Cancel:Bold表示
* UIAlertActionStyle.Destructive:文字色が赤色
==関連項目==
==参考文献==
{{reflist}}
{{stub}}
[[category:Xamarin.iOS]]
ページの作成:「 ==iOS 8以降== iOS8以降ではUIAlertControllerを使えとのこと。 <source lang="csharp"> var alert = UIAlertController.Create("title", "message",...」
==iOS 8以降==
iOS8以降ではUIAlertControllerを使えとのこと。
<source lang="csharp">
var alert = UIAlertController.Create("title", "message", UIAlertControllerStyle.Alert);
alert.AddAction(UIAlertAction.Create("NO", UIAlertActionStyle.Cancel , (handler) => {
Console.WriteLine("NO");
}));
alert.AddAction(UIAlertAction.Create("YES", UIAlertActionStyle.Default, (handler) => {
Console.WriteLine("YES: " + alert.TextFields[0].Text);
}));
alert.AddTextField((textfield) => {
textfield.Placeholder = "textfield";
//
var label = new UILabel(new CGRect(0, 0, 80, 30));
label.Text = "LABEL: ";
textfield.LeftView = label;
textfield.LeftViewMode = UITextFieldViewMode.Always;
});
this.PresentViewController(alert, animated: true, completionHandler: null);
</source>
ボタンのフォントを以下の3つの中から選ぶことができる。
* UIAlertActionStyle.Default:標準
* UIAlertActionStyle.Cancel:Bold表示
* UIAlertActionStyle.Destructive:文字色が赤色
==関連項目==
==参考文献==
{{reflist}}
{{stub}}
[[category:Xamarin.iOS]]