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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:39:06+00:00 2026-06-14T21:39:06+00:00

Good Morning Guys, I have a problem. I have an application that do a

  • 0

Good Morning Guys,

I have a problem. I have an application that do a calculate. If i insert the Label in a same ViewController i watch all.

How do I insert the same Label in another View?

This is the view where there is the calculate.

H.

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController

@property (strong, nonatomic) IBOutlet UITextField *textField1;
@property (strong, nonatomic) IBOutlet UITextField *textField2;

@property (strong, nonatomic) IBOutlet UIButton *result;

@property (strong, nonatomic) IBOutlet UIDatePicker *data;


@end

M.

//
//  ViewController.m
//  IEcigarette
//
//  Created by Federico on 24/11/12.
//  Copyright (c) 2012 Federico. All rights reserved.
//

#import "ViewController.h"
#import "ResultViewController.h"



@interface ViewController ()
@property (strong, nonatomic) NSString * myString;

@property (strong, nonatomic) UILabel * myLabel;
@end

@implementation ViewController

-(IBAction)calculate:(id)sender{



    NSDate *past = _data.date ;
    NSDate *now = [NSDate date];

    NSCalendar *gregorianCalendar = [[NSCalendar alloc]
                                     initWithCalendarIdentifier:NSGregorianCalendar];
    NSUInteger unitFlags = NSDayCalendarUnit;
    NSDateComponents *components = [gregorianCalendar components:unitFlags
                                                        fromDate:past
                                                          toDate:now
                                                        options:0];
    int z = [components day];
    int a = ([_textField1.text intValue]);
    int b = a*([_textField2.text intValue]);

    int r = b * z / 20;

    _myLabel.text = [[NSString alloc] initWithFormat:@"%d", r];
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (BOOL)textFieldShouldReturn:(UILabel *)myLabel {

    [myLabel resignFirstResponder];

    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        [self performSegueWithIdentifier:@"detail" sender:self];
    }

    return YES;
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    if ([segue.identifier isEqualToString:@"detail"]) {

        ResultViewController* destVC = (ResultViewController*)segue.destinationViewController;

        destVC.myString = self.myLabel.text;
        destVC.navigationItem.title = self.myLabel.text;

    }
}

@end

Thank you

  • 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-14T21:39:07+00:00Added an answer on June 14, 2026 at 9:39 pm

    You could keep a reference to it in a shared and call:

    [yourLabel removeFromSuperview];
    [yourViewController.view addSubview:yourLabel];
    

    for every view controller you want to display it on.

    However if what you’re sharing is pretty much functioning as a UILabel, I would recommend using separate UILabel instances for each view controller and just sharing the .text value across views. You could pass the value in prepareForSegue, save it to NSUserDefaults, set it as a property of some shared object/singleton.

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

Sidebar

Related Questions

Good morning one and all. For one reason or another, I have a layer
Good Morning All, I have an Objective C question that is coming from JavaScript.
Good morning/afternoon/evening guys Here is the thing. I'm making a registering gsp that it
Good morning, I have mysql queries where I would like to calculate percentage of
Good morning, I am currently developing a java web application that exposes a web
Good Morning. I have two tables, and one references the other. When I insert
Good morning gang. I have a jQuery Datepicker object that is prepoulated using a
Good Morning All, I am developing a new ASP.net MVC web application. Part of
Good morning, I have found that many of my customers have MS Access already
Good morning. I have a modal JQuery dialog that on Open calls and loads

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.