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 8930145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:49:08+00:00 2026-06-15T08:49:08+00:00

Objective: To get a UIView, which is a small magnifying glass, to be placed

  • 0

Objective: To get a UIView, which is a small magnifying glass, to be placed above the navigation controller. It’s exactly like the loupe in the Notes program.

I have partly accomplished this task with the following code:

MyAppDelegate *app = (MyAppDelegate *)[[UIApplication sharedApplication] delegate];
[[[[app navigationController] view] superview] addSubview:_loupe];

This allows the loupe to be displayed above the navigation controller. Note: The _loupe variable contains an instance of a UIView that will magnify the view.

This code works perfectly when in Portrait. When I change the orientation to Landscape, however, the coordinates of the _loupe appear to still be in portrait mode.

Through lots of trial and error and hours of head banging I realized that the UINavigationController, which is added as the rootViewController of the application, never updates its coordinates when the orientation changes. ALL other views, including the RootViewController (the default class created when creating a new application in XCode) has their coordinates updated.

I tried to rectify this by subclassing the UINavigationController with my own controller to make it so the shouldAutorotateToInterfaceOrientation: gets called by the navigation controller instead of the RootViewController. I was hoping that the reason it didn’t rotate is because it wasn’t the controller requesting the orientation. Nothing.

I’ve also rotated the _loupe view with the following:

CGAffineTransform transform = _loupe.transform;
transform = CGAffineTransformMakeRotation([self degreesToRadians:90.0]);
_loupe.transform = transform;
_loupe.bounds = CGRectMake(0, 0, 480, 320);
_loupe.frame = CGRectMake(0, 0, 80, 80);

This makes the UIView, underneath the touch, magnified right side up. Originally, the UIView underneath was rotated -90 when changing the orientation to the left. So I’m almost there… but the coordinates are still screwed up.

I’ve also tried changing the _loupe.bounds to CGRectMake(0, 480, 480, 320) believing that changing the origin might match the underlying coordinate system. No dice.

My last resort was doing a transform on the actual UITouch x/y points.

    CGPoint point = [touch locationInView:self];
    CGAffineTransform transform = CGAffineTransformRotate([_loupe transform], [self degreesToRadians:90.0]);
    CGPoint tPoint = CGPointApplyAffineTransform(point, transform);

No dice. However, this does make the loupe displayed near the visible area. What I’m finding is that moving the touch on the x axis moves the loupe on the y axis and moving the touch on the y axis moves the loupe on the x axis. So now it’s completely inverted.

In short, I just want an easy way to display a magnifying glass above the navigation controller without all of this rigmarole.

Edit

I got a little closer by converting the point to the loupe’s view.

CGPoint tPoint = [self convertPoint:point toView:_loupe];

This makes the loupe flicker a lot… it also appears to move the loupe on both the x & y axis (vertically) no matter the direction I move the touch. Getting much closer though!

  • 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-06-15T08:49:10+00:00Added an answer on June 15, 2026 at 8:49 am

    Resolution

    This is it:

    CGPoint tPoint = [self convertPoint:point toView:[[[app navigationController] view] superview]];
    

    All I had to do was convert the CGPoint, created from the UITouch event, to that of the coordinate space of the navigation controller’s superview (which the loupe is part of).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't seem to figure out how to get Objective-c to auto box my
I'm new to objective C and I just wanted to get a general clarification
In Objective-c/Cocoa, how do I get the icon that Finder uses for the desktop
How can I get the Timezone offset in Objective-C (for iPhone OS 3)? For
I have a collection of Objective-C classes that get sub-classed at a variety of
I'm finding it difficult to get started in Objective-C. I'm executing the following code
Whats the best way to get the current time (HH:MM:SS) using Objective-C. I would
Is there a way to get the list of currently running threads in objective-C?
I'm seeing an odd behavior with trying to get seconds since epoch in objective
I'm trying to URL encode a string to form a GET request from objective-c.

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.