21 lines
908 B
C#
21 lines
908 B
C#
using UIKit;
|
|||
|
|
|
||
|
|
namespace VoiceCat.iOS;
|
||
|
|
|
||
|
|
internal static class UiHelpers
|
||
|
|
{
|
||
|
|
internal static void ShowError(UIViewController owner, Exception exception) => ShowMessage(owner, "VoiceCat", exception.Message);
|
||
|
|
internal static void ShowMessage(UIViewController owner, string title, string message)
|
||
|
|
{
|
||
|
|
UIAlertController alert = UIAlertController.Create(title, message, UIAlertControllerStyle.Alert);
|
||
|
|
alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null)); owner.PresentViewController(alert, true, null);
|
||
|
|
}
|
||
|
|
|
||
|
|
internal static UITextField Field(string placeholder, bool secure = false)
|
||
|
|
{
|
||
|
|
var field = new UITextField { Placeholder = placeholder, BorderStyle = UITextBorderStyle.RoundedRect,
|
||
|
|
SecureTextEntry = secure, TranslatesAutoresizingMaskIntoConstraints = false };
|
||
|
|
field.AccessibilityLabel = placeholder; return field;
|
||
|
|
}
|
||
|
|
}
|