Skip to content

Instantly share code, notes, and snippets.

@dalexsoto
Created October 23, 2014 16:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dalexsoto/0729c9c4e7f1f7196f82 to your computer and use it in GitHub Desktop.
Save dalexsoto/0729c9c4e7f1f7196f82 to your computer and use it in GitHub Desktop.
// Maybe inside a helper class
[DllImport (MonoTouch.Constants.ObjectiveCLibrary, EntryPoint = "class_addProtocol")]
static extern bool AddProtocol (IntPtr cls, IntPtr protocol);
[DllImport (MonoTouch.Constants.ObjectiveCLibrary, EntryPoint = "objc_getProtocol")]
static extern IntPtr GetProtocol (string name);
// This ones must be called before the actual usage of the class, maybe in finished launching but up to you
var objRestorationProtocol = GetProtocol ("UIObjectRestoration");
AddProtocol (Class.GetHandle (DetailViewController), objRestorationProtocol);
var ctrlRestorationProtocol = GetProtocol ("UIViewControllerRestoration");
AddProtocol (Class.GetHandle (DetailViewController), ctrlRestorationProtocol);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment