private void SetPickerToView() { _picker_model = new CountryCodePickerView(); _picker = new UIPickerView(); _picker.Model = _picker_model; _picker.ShowSelectionIndicator = true; _picker.BackgroundColor = UIColor.White; var toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Default; toolbar.Translucent = true; toolbar.SizeToFit(); var doneButton = new UIBarButtonItem(Application.LocalizedString("Validate"), UIBarButtonItemStyle.Done, (s, e) => { CountryCodeTextField.Text = _picker_model.ValuesPicker[(int)_picker.SelectedRowInComponent(0)].Item1.ToString(); CountryCodeLabel.Text = _picker_model.ValuesPicker[(int)_picker.SelectedRowInComponent(0)].Item2.ToString(); CountryCodeTextField.ResignFirstResponder(); }); toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true); CountryCodeTextField.TouchDown += SetPicker; CountryCodeTextField.InputView = _picker; CountryCodeTextField.InputAccessoryView = toolbar; }
public override void SetDataAndStyleToView() { Title = Application.LocalizedString("ParameterTitle"); InitialiseAllStrings(); // round corner on the button modify the image of the user ModifyUserImageButton.Layer.CornerRadius = 4; ModifyUserImageButton.Layer.BorderWidth = 1; ModifyUserImageButton.Layer.BorderColor = UIColor.FromRGBA(98, 218, 115, 255).CGColor; ModifyUserImageButton.ContentEdgeInsets = new UIEdgeInsets(5, 10, 5, 10); SaveButton.Layer.CornerRadius = 4; SaveButton.Layer.MasksToBounds = true; AboutButton.Enabled = true; LogOutButton.Enabled = true; EmailTextField.Enabled = false; // Free Credits Details RefreshDisplayedCreditCount(); FirstNameTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; }; FirstNameTextField.ShouldReturn += (textField) => { FirstNameTextField.ResignFirstResponder(); return(true); }; LastNameTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; }; LastNameTextField.ShouldReturn += (textField) => { LastNameTextField.ResignFirstResponder(); _hasDataChanged = true; return(true); }; EmailTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; EmailTextField.AutocorrectionType = UITextAutocorrectionType.No; }; EmailTextField.ShouldReturn += (textField) => { EmailTextField.ResignFirstResponder(); _hasDataChanged = true; return(true); }; CountryCodeTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; }; CountryCodeTextField.ShouldReturn += (textField) => { CountryCodeTextField.ResignFirstResponder(); _hasDataChanged = true; return(true); }; PhoneNumberTextField.EditingChanged += (o, e) => { _hasDataChanged = true; SaveButton.Enabled = true; }; PhoneNumberTextField.ShouldReturn += (textField) => { PhoneNumberTextField.ResignFirstResponder(); _hasDataChanged = true; return(true); }; var toolbar = new UIToolbar(); toolbar.BarStyle = UIBarStyle.Default; toolbar.Translucent = true; toolbar.SizeToFit(); // Done button var doneButton = new UIBarButtonItem(Application.LocalizedString("Validate"), UIBarButtonItemStyle.Done, (s, e) => { PhoneNumberTextField.ResignFirstResponder(); }); toolbar.SetItems(new UIBarButtonItem[] { doneButton }, true); PhoneNumberTextField.InputAccessoryView = toolbar; PhoneNumberTextField.InputAccessoryView = toolbar; PhoneNumberTextField.InputAccessoryView = toolbar; FirstNameTextField.Text = App.CurrentUserEnvironment.User.FirstName; LastNameTextField.Text = App.CurrentUserEnvironment.User.LastName; EmailTextField.Text = App.CurrentUserEnvironment.User.Email; PhoneNumberTextField.KeyboardType = UIKeyboardType.DecimalPad; //if (!string.IsNullOrEmpty(App.CurrentUserEnvironment.User.PhoneNumber)) //{ // var phoneNumber = App.CurrentUserEnvironment.User.PhoneNumber.Split('|'); // if (phoneNumber != null && phoneNumber.Length == 2) // { // if (phoneNumber[0].Contains("+")) // { // phoneNumber[0] = phoneNumber[0].Substring(1, phoneNumber[0].Length - 1); // } // CountryCodeTextField.Text = phoneNumber[0]; // PhoneNumberTextField.Text = phoneNumber[1]; // } //} UserImageView.Layer.CornerRadius = UserImageView.Frame.Size.Width / 2; UserImageView.ClipsToBounds = true; if (!string.IsNullOrEmpty(App.CurrentUserEnvironment.User.UserPicture)) { using (var dataDecoded = new NSData(App.CurrentUserEnvironment.User.UserPicture , NSDataBase64DecodingOptions.IgnoreUnknownCharacters)) { UserImageView.Image = new UIImage(dataDecoded); } } SaveButton.Enabled = false; }