Is it possible to allow the user to click on the image part of a TableView with a Subtitle? I have a list of contacts and would like my users to be able to click on the icon to call/dial the contact.
Thanks in advance,
Create Event and call the event when clicking .
imageView = new UIImageView(); imageView.UserInteractionEnabled = true; UITapGestureRecognizer tap = new UITapGestureRecognizer(()=> { ClickEvent(); }); tap.NumberOfTapsRequired = 1; imageView.AddGestureRecognizer(tap);
Handle in the event in GetCell
method in tableview Delegate.
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) { // request a recycled cell to save memory CustomVegeCell cell = tableView.DequeueReusableCell (cellIdentifier) as CustomVegeCell; // if there are no cells to reuse, create a new one if (cell == null) { cell = new CustomVegeCell (cellIdentifier); } cell.ClickEvent += ()=>{ new UIAlertView("Image Clicked" , "", null, "OK", null).Show(); }; // xxx
Check my sample below
Answers
Create Event and call the event when clicking .
Handle in the event in
GetCell
method in tableview Delegate.Check my sample below
Thank you!