예제 #1
0
        //METHODS
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            this.NavigationItem.SetRightBarButtonItem(
                new UIBarButtonItem(UIBarButtonSystemItem.Add, (sender, args) => {
                // button was clicked
                //Create Alert
                var textInputAlertController = UIAlertController.Create("Add Song", null, UIAlertControllerStyle.Alert);

                //Add Text Input
                textInputAlertController.AddTextField(textField => {
                });

                //Add Actions
                var cancelAction = UIAlertAction.Create("Cancel", UIAlertActionStyle.Default, alertAction => Console.WriteLine("Cancel was Pressed"));
                var okayAction   = UIAlertAction.Create("Add", UIAlertActionStyle.Cancel, alertAction =>
                {
                    AllSongs_IndividualSong song = new AllSongs_IndividualSong(textInputAlertController.TextFields[0].Text.ToString());
                    allSongs.AddSongToList(song);
                    TableView.ReloadData();
                });

                textInputAlertController.AddAction(cancelAction);
                textInputAlertController.AddAction(okayAction);

                //Present Alert
                PresentViewController(textInputAlertController, true, null);
            })
                , true);
        }
예제 #2
0
 //METHODS
 public void AddSongToList(AllSongs_IndividualSong song)
 {
     allSongs.Add(song);
 }