Skip to content

Instantly share code, notes, and snippets.

@sbrocket
Created April 1, 2011 04:55
Show Gist options
  • Select an option

  • Save sbrocket/897761 to your computer and use it in GitHub Desktop.

Select an option

Save sbrocket/897761 to your computer and use it in GitHub Desktop.
// Works
if (self.currentScope == 1) {
cell.contentViewInsets = UIEdgeInsetsMake(0, 0, 0, 2);
} else {
cell.contentViewInsets = UIEdgeInsetsZero;
}
// Works
UIEdgeInsets inset = (self.currentScope == 1) ? UIEdgeInsetsMake(0, 0, 0, 2) : UIEdgeInsetsZero;
cell.contentViewInsets = inset;
// Works, guess its related to dot syntax
[cell setContentViewInsets:(self.currentScope == 1) ? UIEdgeInsetsMake(0, 0, 0, 2) : UIEdgeInsetsZero];
// Doesn't work, compiler warning & error
cell.contentViewInsets = (self.currentScope == 1) ? UIEdgeInsetsMake(0, 0, 0, 2) : UIEdgeInsetsZero;
// More variations that don't work
cell.contentViewInsets = ((self.currentScope == 1) ? UIEdgeInsetsMake(0, 0, 0, 2) : UIEdgeInsetsZero);
cell.contentViewInsets = (self.currentScope == 1) ? (UIEdgeInsetsMake(0, 0, 0, 2)) : UIEdgeInsetsZero;
cell.contentViewInsets = (self.currentScope == 1) ? (UIEdgeInsetsMake){0, 0, 0, 2} : UIEdgeInsetsZero;
cell.contentViewInsets = ({(self.currentScope == 1) ? UIEdgeInsetsMake(0, 0, 0, 2) : UIEdgeInsetsZero;});
error: assignment of read-only variable 'prop.282'
warning: left-hand operand of comma expression has no effect
Compiler is either "GCC 4.2" or "LLVM GCC 4.2" in Xcode 4.0 4A304a
Compiles correctly with "LLVM compiler 2.0" selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment