Skip to content

Instantly share code, notes, and snippets.

@Sahil
Created April 27, 2012 20:27
Show Gist options
  • Save Sahil/2512744 to your computer and use it in GitHub Desktop.
Save Sahil/2512744 to your computer and use it in GitHub Desktop.
Easier way to create a UIViewAutoresizing mask
// the last param must be NSNotFound
+ (UIViewAutoresizing)autoresizeWithMask:(UIViewAutoresizing)firstMask, ... {
va_list args;
va_start(args, firstMask);
UIViewAutoresizing autoresizingMask = UIViewAutoresizingNone;
for (UIViewAutoresizing nextMask = firstMask; nextMask != NSNotFound; nextMask = va_arg(args, UIViewAutoresizing)) {
autoresizingMask |= nextMask;
}
va_end(args);
return autoresizingMask;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment