What's a simple way to get a text input popup dialog box on an iPhone

后端 未结 12 2057
-上瘾入骨i
-上瘾入骨i 2020-12-02 03:42

I want to get the user name. A simple text input dialog box. Any simple way to do this?

12条回答
  •  情深已故
    2020-12-02 04:20

    In Xamarin and C#:

    var alert = new UIAlertView ("Your title", "Your description", null, "Cancel", new [] {"OK"});
    alert.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
    alert.Clicked += (s, b) => {
        var title = alert.ButtonTitle(b.ButtonIndex);
        if (title == "OK") {
            var text = alert.GetTextField(0).Text;
            ...
        }
    };
    
    alert.Show();
    

提交回复
热议问题