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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:56:40+00:00 2026-05-30T01:56:40+00:00

I am a novice to IOS programming hence struggling a bit with the below

  • 0

I am a novice to IOS programming hence struggling a bit with the below problem. I will do my best to describe the problem and any help is greatly appreciated.

I have the following created:

  • AboutViewController (.h, .m and .xib ) which has two subviews called – mainView, infoView. mainView and infoView interfaces are created in the XIB file.
  • TestView ( View to deal with initiating, toggling between mainView and infoView )

TestView.h is as follows:

@interface TestView : UIView {

    IBOutlet UIView *mainView;
IBOutlet UIView *infoView;

    UILabel *lbltitle;
    UIImageView *imgIcon;
IBOutlet UITextView *txtInfo1;
    IBOutlet UITextView *txtInfo2;
IBOutlet UITextView *txtInfo3;



}

@property (nonatomic, retain) IBOutlet UILabel *lbltitle;
@property (nonatomic, retain) IBOutlet UIImageView *imgIcon;

TestView.m is as follows:

#import "TestView.h"

#import <QuartzCore/QuartzCore.h>

@implementation TestView
@synthesize lbltitle, imgIcon;

-(void)awakeFromNib
{
[self addSubview:mainView];
}

In portrait mode the views are working great but when it comes to landscape mode, the views are all kinda screwed up. I tried to use the XIB but I guess you can only do so much so I decided to do this programmatically.

In the AboutViewController.m, I am trying to override willAnimateRotationToInterfaceOrientation method and place the objects based on the orientation. When I put breakpoints, I can see that code is being called except it is not translating into the UI i.e., no change in the UI. What am I doing wrong ? Should I be approaching this in a different way. Any suggestions or guidance is greatly appreciated.

- (void)willAnimateRotationToInterfaceOrientation:  (UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{

   TestView *t = [[TestView alloc]init];

if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
    toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
    {
        [t.imgIcon setFrame:CGRectMake(10,74,165,190)];
        [t.lbltitle setFrame:CGRectMake(20, 10, 387, 21)];
    }
else
    {
        [t.imgIcon setFrame:CGRectMake(10,74,165,190)];
        [t.lbltitle setFrame:CGRectMake(189, 10, 387, 21)];

    }
}
  • 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-30T01:56:41+00:00Added an answer on May 30, 2026 at 1:56 am

    Well the particular problem is you manipulate a view that you just created using

    TestView *t = [[TestView alloc]init];
    

    You don’t display the view anywhere, so it sits in memory. You can apply all changes you want, but to be able to see them, you must first display the view:

    Find the appropriate parent and do:

    [parentview addSubview:t];
    

    In more general terms you shouldn’t be creating new views in the rotation handling code.

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

Sidebar

Related Questions

I am a novice in iOS programming and I have some novice questions. I
I am a AS3 novice learning PureMVC and want to write code following best
I am novice in sharepoint programming. I have a following code: SPWorkflowTask task =
I'm a novice iOS developer with a basic knowledge of Xcode. I have one
I am novice to HTTP related matters. My question is in iOS development, I
While learning iOS programming from a book, I notice that for long lines of
I'm a novice in iOS developing, and have some problems with understanding web service
Php novice. 1.Is there anything wrong with this PHP & MySQL code? include_once db_login.php
As a novice developer who is getting into the rhythm of my first professional
I am a novice programmer who is trying to teach myself to code, specifically

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.