Skip to content

Instantly share code, notes, and snippets.

@benbishop
benbishop / DismissSegue
Created June 5, 2014 15:11
A custom UIStoryboardSegue class for dismissing modals in Xamarin.iOS
using System;
using MonoTouch.UIKit;
using MonoTouch.Foundation;
namespace Rendr
{
[Register ("DismissSegue")]
public class DismissSegue:UIStoryboardSegue
{
public DismissSegue (IntPtr param) : base (param)
@benbishop
benbishop / ViewGroup.SetChildrenEnabled
Created March 5, 2014 20:13
A C# Xamarin Class Extension for ViewGroup that lets you easily disable all contents of ViewGroup from touches.
using System;
using Android.Views;
using Android.Widget;
namespace Rendr.Community
{
public static class UIExtensions
{
public static void SetChildrenEnabled (this ViewGroup group, bool enabled)
{
@benbishop
benbishop / Xamarin iOS Environment Util
Created November 19, 2013 12:04
A simple utility class to help keep track of various environment attributes.
using System;
using MonoTouch.UIKit;
using System.Drawing;
namespace Rendr.iOS.Util
{
public static class Environment
{
public static bool IsIOS7{
get{
@benbishop
benbishop / IOSResourceManager
Last active December 21, 2015 02:09
A simple way to reuse your Strings.xml file from your Xamarin.Android app in Xamarin.IOS. To use, this all you have to do is include the Strings.xml file in the root of your project as a Bundle Resource.
public static class ResourceManager
{
static XDocument stringsDoc;
static XDocument integersDoc;
static ResourceManager ()
{
stringsDoc = XDocument.Load ("Strings.xml");
integersDoc = XDocument.Load ("Integers.xml");
function getXHR(url, callback) {
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200 || this.status == 0) {
callback(this.responseText);
} else {
alert('Request failed')
}