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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:38:21+00:00 2026-06-02T17:38:21+00:00

My application has two ViewControllers linked with NavigationController. The First NavigationController has one view

  • 0

My application has two ViewControllers linked with NavigationController. The First NavigationController has one view with buttons and one view with labels. This view is a circular rotating menu and it represents my home page. The views can rotate with CGAffineTransformMakeRotation – QuartzCore (apparently it’s causing the issue) on touchesMoved:.

I wanted to hide the NavigationBar only in this view, so I used setNavigationBarHidden:YES on ViewWillAppear. Then show the bar on ViewWillDisappear.

On the simulator, everything works as expected until i rotate the first ViewController, when i rotate then click on any button (go to the second ViewController) then click on Back (to go back to my first ViewController), everything will be distorted!.

  1. I tried to fix the issue by adding [self.view setBounds:[[UIScreen
    mainScreen]bounds]];
    *[self.view setFrame:[[UIScreen
    mainScreen]bounds]];* in ViewDidLoad method or ViweWillAppear,
    the issue remains.
  2. I tried to set NavigationBar alpha to 0 in ViewWillAppear and set
    it to 1 on ViewWillDisappear and I tried
    self.navigationController.navigationBar.translucent = YES both
    options didn’t resolve the problem.
  3. I tried to set programmatically views, buttons and labels positions
    in ViewWillAppear and it doesn’t resolve the problem.
  4. I doubted the animation so I removed it but it hasn’t any effect on the problem.

As a beginner I’m unable to resolve this issue, please help!

ViewController.h (first ViewController)

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

@interface ViewController : UIViewController

@property (nonatomic, strong) IBOutlet UIView *aView;
@property (nonatomic, strong) IBOutlet UIView *bView;

@property (nonatomic, strong) IBOutlet UIButton *bimg1;
…
@property (strong, nonatomic) IBOutlet UILabel *label1;
…
-(void) rotateTo:(CGFloat)x andY:(CGFloat)y;

@end

ViewController.m

#import "ViewController.h"

@implementation ViewController
@synthesize aView = _aView;
…
@synthesize bimg1 = _bimg1;
…
@synthesize label1 = _label1;
…

static inline double toradians (double degrees) {
return degrees * M_PI/180;
}

-(void)viewDidLoad {
    ![enter image description here][1][super viewDidLoad];
    //Set text font
    [_label1 setFont:[UIFont fontWithName:@"Consolas" size:16]];
…
    [self.view setBounds:[[UIScreen mainScreen]bounds]];
    [self.view setFrame:[[UIScreen mainScreen]bounds]];
}

-(void)viewWillAppear:(BOOL)animated {
    self.navigationController.navigationBar.hidden = YES;
    printf("Aview x: %f     | Aview y: %f \n",self.aView.frame.origin.x, self.aView.frame.origin.y);
    printf("Aview width: %f | Aview height: %f \n",self.aView.frame.size.width,    self.aView.frame.size.height);
}

-(void)viewWillDisappear:(BOOL)animated {
    self.navigationController.navigationBar.hidden = NO;
}

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [touches anyObject];
    CGPoint LastTouchPoint = [touch locationInView:self.view];
    CGFloat LasTouchx = LastTouchPoint.x;
    CGFloat LasTouchy = LastTouchPoint.y;

    CGPoint CenterPoint = self.view.center;
    CGFloat x = LasTouchx - CenterPoint.x;
    [self rotateTo:x andY:y];
}

-(void) rotateTo:(CGFloat)x andY:(CGFloat)y {
    CGFloat angle = x/y;
    angle = atan(angle);
    angle = angle * 360/M_PI;
    angle *= 0.0174532925;

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [UIView setAnimationDuration:1];
    self.aView.transform=CGAffineTransformMakeRotation(-angle); 
    self.bView.transform=CGAffineTransformMakeRotation(-angle); 

    self.bimg1.transform=CGAffineTransformMakeRotation(angle);
    self.bimg2.transform=CGAffineTransformMakeRotation(angle);
    self.bimg3.transform=CGAffineTransformMakeRotation(angle);
    self.bimg4.transform=CGAffineTransformMakeRotation(angle);

    self.label1.transform=CGAffineTransformMakeRotation(angle);
    self.label2.transform=CGAffineTransformMakeRotation(angle);
    self.label3.transform=CGAffineTransformMakeRotation(angle);
    self.label4.transform=CGAffineTransformMakeRotation(angle);
    [UIView commitAnimations];
}

- (void)viewDidUnload
{
    [self setBimg1:nil];
    … 
    [self setAView:nil];
    [self setBView:nil];
    [super viewDidUnload];
 }
  • 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-02T17:38:24+00:00Added an answer on June 2, 2026 at 5:38 pm

    Yeah, I figured out the problem… The autoresize of the main View was squeezing my subviews when the NavigationController is hidden or not. so i added self.view.autoresizesSubviews = NO; to ViewDidLoad and the problem is fixed.

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

Sidebar

Related Questions

I have an application that has two threads. The first one (the main thread)
In my application has two Activities. One is main activity and other is activity
My small windows form application has two radio buttons, and initially neither is checked.
My app has two buttons, the first button is for deleting record on user
My application has a following requirement. 1) First screen has two tabs. 2) From
I have an application that has two map views one satellite and one street
My application has two activities, that I start in this order: HOME > A
My application has two requirements where one screen is an numeric entry and other
My application has two node types: a parent node which can hold recursive child
I'm trying to build an iPhone application that has two subviews in the main

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.