I think you have a scope issue.  Try promoting the button variable to a
class level variable.



*James Texter III*

|

Technical Guru

|

james.tex...@monscierge.com

300 Johnny Bench Dr. Suite 120

|

Oklahoma City, OK 73104

|

888-426-5730

|

www.monscierge.com <http://monscierge.com>



*From:* monotouch-boun...@lists.ximian.com [mailto:
monotouch-boun...@lists.ximian.com] *On Behalf Of *Wally McClure
*Sent:* Monday, June 13, 2011 3:37 PM
*To:* monotouch@lists.ximian.com
*Subject:* [MonoTouch] adding a back button



I wanted to add a back button on my view when I load it.  Unfortunately, I
am unable to get the back button to display.  I have the code below in my
ViewDidLoad() method.  Any suggestions are appreciated.



                        public override void ViewDidLoad()

                        {

                                    // Do some other things

                            var btn = new UIBarButtonItem ("Back",
UIBarButtonItemStyle.Plain, delegate (object sender, EventArgs e) {

                                          Console.WriteLine("BarButtonItem
clicked.");

                                    });



                                    ToolbarItems = new UIBarButtonItem[]
{btn};

                                    SetToolbarItems(ToolbarItems, true);

                                    base.ViewDidLoad();

                        }
_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to