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

  • Home
  • SEARCH
  • 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 9122501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:07:08+00:00 2026-06-17T06:07:08+00:00

I have the following code in the viewWillAppear function: CAGradientLayer *bgLayer = [BackgroundLayer yellowGradient];

  • 0

I have the following code in the viewWillAppear function:

CAGradientLayer *bgLayer = [BackgroundLayer yellowGradient];
[bgLayer setBounds:self.view.bounds];
[self.view.layer insertSublayer:bgLayer atIndex:0];

It works perfectly in portrait orientation. However, when the device goes into landscape mode, it produces a white (or default color) background down the side. I have seen other examples of WHY this occurs, but nothing on how to fix it.

What I’m seeing happening is the 1024 resolution on landscape (iPad) dropping to 1004, and I think it’s adjusting it to 0,20 on the x, y.

Has anyone else run into this issue and found how to fix it?

  • 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-17T06:07:09+00:00Added an answer on June 17, 2026 at 6:07 am

    It’s because when you turn the screen sideways, your view, which has a certain background color, does not turn sideways. The view remains in portrait. So you have this portrait-oriented colored view that’s going from the new “top” of the iPad to way below off screen, and on the right side, the view isn’t wide enough to reach, so you just see the app’s default (white) background color.

    You can:

    • apply a CGAffineTransformMakeRotation rotation to your self.view 90º, so that it now displays properly in your now-landscape application,
    • make your view big enough to cover the entire device, in both landscape and portrait,
    • make a view with the proper landscape dimensions, and add it when the iPad rotates, or
    • disable those allowed interface orientations in your Xcode main project file.

    Link to CGAffineTransformRotation Demo Code on SO: How to use CGAffineTransformMakeRotation?

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

Sidebar

Related Questions

I have the following code - (void) viewWillAppear:(BOOL)animated { NSLog(@dismiss view); [self dismissModalViewControllerAnimated:YES]; }
I have the following code in my viewWillAppear: - (void) viewWillAppear:(BOOL)animated{ self.view.backgroundColor = [UIColor
I have the following code in viewWillAppear in my view controller. - (void) viewWillAppear:(BOOL)animated
I have set the following code in a viewWillAppear method. - (void)viewWillAppear:(BOOL)animated { //some
I have the following structure: UIViewController > UIView (self.view) > UITableView (self.tableView - IBOutlet)
I have following code: class EntityBase (object) : __entity__ = None def __init__ (self)
In my loadView methoad of my view controller I have the following code: //
I have added UITabButtonItem onto my view controller using following code. Could anyone please
Have following code. object.waypoint=function () { this.uw=setInterval( function() { console.log(this); }, 200); } How
I have the following code: -(void)viewWillAppear:(BOOL)animated { UIDeviceOrientation orientation = [[UIDevice currentDevice] UIInterface]; if(orientation==UIDeviceOrientationLandscapeLeft

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.