Created
November 19, 2011 23:02
-
-
Save spouliot/1379500 to your computer and use it in GitHub Desktop.
patch to add AccessoryTapped in MonoTouch.Dialog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/MonoTouch.Dialog/DialogViewController.cs b/MonoTouch.Dialog/DialogViewController.cs | |
index 19bbf70..f7828d8 100644 | |
--- a/MonoTouch.Dialog/DialogViewController.cs | |
+++ b/MonoTouch.Dialog/DialogViewController.cs | |
@@ -300,6 +300,14 @@ namespace MonoTouch.Dialog | |
Root = container.root; | |
} | |
+ public override void AccessoryButtonTapped (UITableView tableView, NSIndexPath indexPath) | |
+ { | |
+ var section = Root.Sections [indexPath.Section]; | |
+ var element = (section.Elements [indexPath.Row] as StyledStringElement); | |
+ if (element != null) | |
+ element.AccessoryTap (); | |
+ } | |
+ | |
public override int RowsInSection (UITableView tableview, int section) | |
{ | |
var s = Root.Sections [section]; | |
diff --git a/MonoTouch.Dialog/Elements.cs b/MonoTouch.Dialog/Elements.cs | |
index 7e79295..c931a3d 100644 | |
--- a/MonoTouch.Dialog/Elements.cs | |
+++ b/MonoTouch.Dialog/Elements.cs | |
@@ -699,6 +699,7 @@ namespace MonoTouch.Dialog | |
} | |
protected UITableViewCellStyle style; | |
+ public NSAction AccessoryTapped; | |
public UIFont Font; | |
public UIFont SubtitleFont; | |
public UIColor TextColor; | |
@@ -867,6 +868,13 @@ namespace MonoTouch.Dialog | |
return; | |
root.TableView.ReloadRows (new NSIndexPath [] { IndexPath }, UITableViewRowAnimation.None); | |
} | |
+ | |
+ internal void AccessoryTap () | |
+ { | |
+ NSAction tapped = AccessoryTapped; | |
+ if (tapped != null) | |
+ tapped (); | |
+ } | |
} | |
public class StyledMultilineElement : StyledStringElement, IElementSizing { |
Honestly I don't recall. Likely it was the only place where the accessory button was exposed. I suggest you to propose a more general fix (as a push request) directly to Miguel's git repository.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why is there an assumption that only StyledStringElement elements have an AccessoryTap() method?
I've implemented a UIViewElement derived element which sets the details accessory but since it isn't a StyledStringElement the patch above doesn't propagate AccessoryTap to my element.
Regards