Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 705255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:01:58+00:00 2026-05-14T04:01:58+00:00

I have this chronic issue with iPhone UI development where views sometimes seem to

  • 0

I have this chronic issue with iPhone UI development where views sometimes seem to appear on the screen in a location different than what is reported by their frame property. Here is what I am doing to try to debug the issue:

UIView *currentView = self.view;
while (currentView!=nil)
{
   NSLog(@"frame: %f,%f,%f,%f", currentView.frame.origin.x, 
                                currentView.frame.origin.y,
                                currentView.frame.size.width,
                                currentView.frame.size.height);
   currentView = currentView.superview;
}

I expect this should show me the coordinates and size of each element up the hierarchy from the given view to the app’s root UIWindow element, with the coordinates for each element relative to its parent. However, that does not seem to be the case. In my current situation, I have a UI I’m trying to debug where every other time I rotate the device, the whole UI shifts up or down 20 pixels, yet the code block above reports exactly the same numbers every time. I tried calling the above code after as much as a second delay, but that the numbers still come out the same each time.

Does anyone know a better way to inspect the screen coordinates of UI elements? If I can detect when one is wrong, I can compensate for the problem when it appears.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:01:59+00:00Added an answer on May 14, 2026 at 4:01 am

    Some things you can try out:

    • Instead of rolling your own, you can use the recursiveDescription method of UIView (undocumented, but works great). (Reference)
    • Alter your code to NSLog the points in terms of other views using the four methods called convert{Point,Rect}:{to,from}View:. E.g., call convertRect:fromView: on your app’s window, handing in a bunch of frames from subviews.

    I also previously had a weird off-by-20-pixels bug. I never 100% solved it, but I had two ideas that might help:

    • Double-check that you’re calleding makeKeyAndVisible on your window object when your app first starts. If your window is not set as “key” then some subtle weird things can do wrong.
    • Try to find the point in your code when the frame is resized and reset it. You might have to use the performSelector:withObject:afterDelay: method to reset it after the OS messes it up for you. Check out this post on NSRunLoop for more details on why that method is useful.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.