Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

simple but unusal!

$
0
0

Guys I have a problem with GetHeaderSection of UITableView. I have a custom view in the Header with a button inside. When I try to click the button, crash occurs ( Is my element GC collected ? or how can I resolve it )

`public override UIView GetViewForHeader (UITableView tableView, int section) { UIView view = new UIView ();

        UIButton addButton = new UIButton (UIButtonType.ContactAdd);

        addButton.Frame=new RectangleF(250, 0, 100, 40);
        addButton.TouchUpInside += (object sender, EventArgs e) => {
            new UIAlertView ("Row Selected", "test", null, "OK", null).Show ();
        };
        view.AddSubview (addButton);
        view.Frame = new RectangleF (0, 0, 400, 40);

        return view;`

Please suggest.. addButton.TouchUpInside never works. Hopefully it is GC'd. How can I resolve this ? any work around ?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>