That is because you are adding the button on a UIImageView, which does not have user interaction enabled by default. Assign its UserInteractionEnabled property to true so that it can tunnel user interaction to its subviews. You do not have to set UserInteractionEnabled to a UIButton, because it is enabled by default.
Dimitris Tavlikos Software Developer Email: [email protected] Twitter: http://www.twitter.com/dtavlikos Blog: http://software.tavlikos.com 29 Μαϊ 2011, 20:52, ο/η Andreas Ploetzeneder <[email protected]> έγραψε: > hi,has anybody got an idea > > why the touchdown of the button does not react > System.Diagnostics.Debug.WriteLine("halo"); > // If you have defined a view, add it here: > // window.AddSubview (navigationController.View); > var sv = new UIScrollView (window.Frame); > var iv = new UIImageView (UIImage.FromFile ("plan.jpg")); > UIButton x = UIButton.FromType(UIButtonType.Custom); > x.Frame=new System.Drawing.RectangleF(100,100,100,100); > x.BackgroundColor= UIColor.Red; > x.TouchDown+=delegate{ > System.Diagnostics.Debug.WriteLine("asdf"); > }; > x.UserInteractionEnabled=true; > x.SetTitle("Search", UIControlState.Normal); > > iv.AddSubview(x); > sv.AddSubview (iv); > sv.ContentSize = iv.Frame.Size; > sv.MinimumZoomScale = 0.01f; > sv.MaximumZoomScale = 10.0f; > sv.MultipleTouchEnabled = false; > > sv.ViewForZoomingInScrollView = delegate(UIScrollView scrollView) { > return iv; > }; > > window.AddSubview (sv); > window.MakeKeyAndVisible (); > > window.MakeKeyAndVisible (); > > return true; > } > _______________________________________________ > MonoTouch mailing list > [email protected] > http://lists.ximian.com/mailman/listinfo/monotouch _______________________________________________ MonoTouch mailing list [email protected] http://lists.ximian.com/mailman/listinfo/monotouch
