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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:44:58+00:00 2026-05-18T01:44:58+00:00

I try to change the read and change the position from a UILabel. This

  • 0

I try to change the read and change the position from a UILabel. This UILabel has been created in Interface Builder and now i want to read and change the position inside another class, when i call a method in the MainVieController class.

But how can i do that, i’ve read several forums but i can’t get it work. Here’s also some sample code. I hope someone can help me with this.

MainViewController.h

#import <UIKit/UIKit.h>
@class NewClass;

@interface MainViewController : UIViewController {

    UILabel *daLabel;

}

@property (nonatomic, retain) IBOutlet UILabel *daLabel;

@end

MainViewController.m

#import "MainViewController.h"
#import "NewClass.h"

@implementation MainViewController
@synthesize daLabel;

- (void)viewDidLoad {

    [super viewDidLoad];

    NewClass *anotherClass = [[NewClass alloc] init];
    [anotherClass test];

}

@end

NewClass.h

#import <Foundation/Foundation.h>
@class MainViewController;

@interface NewClass : NSObject {

}

@end

NewClass.m

#import "NewClass.h"
#import "MainViewController.h"

@implementation NewClass

- (void)test {

    MainViewController *MainController = [[MainViewController alloc] init];

    CGRect labelPosition = MainController.daLabel.frame;
    NSLog(@"POSITION: %f", labelPosition.origin.x); // Returns 0.000000

}

@end
  • 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-18T01:44:59+00:00Added an answer on May 18, 2026 at 1:44 am

    I’m not sure why you’re creating another instance of your view controller in NewClass, which is loaded by your view controller. Maybe just pass “self” in the call to the test method? But if you want to change the position of your UILabel, just change labelPosition and then set daLabel.frame to the modified labelPosition. For example:

    - (void)viewDidLoad {
        [super viewDidLoad];
        NewClass *anotherClass = [[NewClass alloc] init];
        [anotherClass test:self];
    
    }
    
    - (void)test:(MainViewController *)mvc {
        CGRect labelPosition = mvc.daLabel.frame;
        NSLog(@"POSITION: %f", labelPosition.origin.x); // Returns 0.000000
        labelPosition.origin.x = 50;
        mvc.daLabel.frame = labelPosition;  // Now moved to 50.000000
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I try to change the dimensions of the view in interface builder from the
I try to change the color from a UIPopoverControler on iOS 5. To do
I try to change over htaccess from http://www.mydomain.com/pictures/generated/product/1/280_280_75/nopic.jpg to http://www.mydomain.com/pictures/generated/product/1/280_280_75/nopic1.jpg Here is my rules
example i try to change cell.accessoryView from picture1 to picture2 by fadein but my
I've been wanting to work on this application for about a year now. I
I'm trying to read a clob from postgreSQL DB, change it, and write it
I am new in facebook application,i am try to change code from fbml to
I have developed a service with vb.net. This service is been installed from a
I try to read data from a table in html. I read periodically and
I have problem with c# script who change user AD password, when try change

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.