Skip to content

Instantly share code, notes, and snippets.

@scheinem
Last active August 29, 2015 13:55
Show Gist options
  • Save scheinem/8688288 to your computer and use it in GitHub Desktop.
Save scheinem/8688288 to your computer and use it in GitHub Desktop.
Weird UIDatePicker setFrame: bug
// First run:
CGRect testRect = CGRectMake(0.f, 0.f, 320.f, 215.5f);
testRect = CGRectIntegral(CGRectInset(testRect, 15.f, 0.f));
// RESULT: testRect = (15 0; 290 216);
self.datePicker.frame = testRect;
// RESULT: self.datePicker.frame = (15 0; 290 216);
// Second run:
testRect = CGRectMake(0.f, 0.f, 320.f, 215.5f);
// RESULT: testRect = (15 0; 290 215.5);
self.datePicker.frame = CGRectInset(testRect, 15.f, 0.f);
// RESULT: self.datePicker.frame = (15 0; 290 180);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment