0

I have problems with positioning floating buttons in right location based on the screen size. It works great when on iPhone 4s but it's in completely different place when on iPhone 6. Could you tell me how to determinate the different iPhones please?

iPhone 4s

editOptionsView = [[UIView alloc] initWithFrame:CGRectMake(226.0f, 540.0f, [[self view] bounds].size.height, 40.0f)];

iPhone 6

editOptionsView = [[UIView alloc] initWithFrame:CGRectMake(226.0f, 627.0f, [[self view] bounds].size.height, 40.0f)];

Thanks a lot

Simon McLoughlin
  • 8,293
  • 5
  • 32
  • 56
  • 4
    You should use Auto Layout, it is intended to solve many problems, this being one of them. – bpapa Jan 16 '15 at 17:08

2 Answers2

0

The 'bounds' property of the view should give you what you're looking for.

UIView frame, bounds and center

Community
  • 1
  • 1
KirkSpaziani
  • 1,962
  • 12
  • 14
0

You can always get the screen size by asking the main screen:

[[UIScreen mainScreen] bounds]

although it's not always the best practice.

wolffan
  • 1,084
  • 10
  • 15