Skip to content

Instantly share code, notes, and snippets.

@anujb
Created October 27, 2011 15:43
Show Gist options
  • Save anujb/1319930 to your computer and use it in GitHub Desktop.
Save anujb/1319930 to your computer and use it in GitHub Desktop.
responder chain psueudocode -- untested
public T GetContainerOfType<T>(UIView view) where T : UIViewController
{
var type = typeof(T);
var nextResponder = view.NextResponder;
if(typeof(nextResponder) == type) {
return nextResponder;
}
else if(typeof(nextResponder) == typeof(UIView)) {
return GetResponderOfType<T>(nextResponder);
}
else {
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment