Why not just create a uibutton (by default they are "custom") that is just
text?

Otherwise, you really need to subclass UILabel and override the touches the
expose an event... something akin to

public class MyTouchableLabel : UILabel
{
   public MyTouchableLabel(RectangleF rect) : base(rect)
   {
      blah blah
   }

   public event EventHandler OnTouched;

   private void RaiseOnTouched()
   {
   }

   private void TouchesBegan()
   {
      // detect touched here and "raise" the event
   }
}

*** note *** I've seen/had many issues with handling large-scale operations
in touch-events that lead to custom-event handling (such as above) - far
better luck simply utilizing what's available in unique ways - for example,
use a UIButton and just latch onto the "TouchUpInside" event - by default,
when you create a UIButton via the standard constructor it is borderless and
pretty much blank - you can set the title and other characteristics and
simply leverage the events already generated by the class vs. trying to
execute lots of stuff within a custom event associated with "TouchesBegan". 
However, if you really just want a label that is clickable, it's subclass
and override time.

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/How-to-use-a-UILabel-as-a-button-tp4655352p4655510.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to