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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:36:19+00:00 2026-06-13T16:36:19+00:00

so i have problems to calculate UIlabel text height after passing it to another

  • 0

so i have problems to calculate UIlabel text height after passing it to another window/viewcontrollers

heres my code to passing

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NetraDealsObject *dataObject=[self.deals_data_json objectAtIndex:indexPath.row];

    detailViewController = [[MJDetailViewController alloc] initWithNibName:@"MJDetailViewController" bundle:nil];
    [self presentPopupViewController:detailViewController animationType:MJPopupViewAnimationSlideBottomBottom];
    detailViewController.NetraPopupPrice.text=dataObject.formatted;

}

for example the text==123;

and here the detailviewController

-(id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self=[super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if(self){

        NetraPopupPrice=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        NetraPopupPrice.backgroundColor=[UIColor colorWithRed:0.31 green:0.733 blue:0 alpha:1]; /*#4fbb00*/
        NetraPopupPrice.textColor=[UIColor whiteColor];
        NetraPopupPrice.textAlignment=NSTextAlignmentCenter;
        NetraPopupPrice.font=[UIFont fontWithName:@"HelveticaNeue-Bold" size:18];
        [NetraPopupPrice.layer setCornerRadius:3];


        NetraPopupProvider=[[UILabel alloc] initWithFrame:CGRectMake(135.0f, 55, 80, 16)];
        NetraPopupProvider.backgroundColor=[UIColor clearColor];
        NetraPopupProvider.textColor=[UIColor colorWithRed:0.769 green:0.776 blue:0.788 alpha:1];
        NetraPopupProvider.font=[UIFont fontWithName:@"Helvetica" size:13];

        //separator
        NetraPopupSeparator=[[UILabel alloc] initWithFrame:CGRectMake(215,55.0f, 80, 16)];
        NetraPopupSeparator.text=@"-",
        NetraPopupSeparator.backgroundColor=[UIColor clearColor];
        NetraPopupSeparator.textColor=[UIColor colorWithRed:0.769 green:0.776 blue:0.788 alpha:1];
        NetraPopupSeparator.font=[UIFont fontWithName:@"Helvetica" size:13];

        //
        //separator
        NetraPopupLocation=[[UILabel alloc] initWithFrame:CGRectMake(225,  55.0f, 70, 16)];
        NetraPopupLocation.backgroundColor=[UIColor clearColor];
        NetraPopupLocation.textColor=[UIColor colorWithRed:0.769 green:0.776 blue:0.788 alpha:1];
        NetraPopupLocation.font=[UIFont fontWithName:@"Helvetica" size:13];

        NetraPopupHeadline=[[UILabel alloc] init];
        NetraPopupHeadline.textColor=[UIColor colorWithRed:0.227 green:0.243 blue:0.247 alpha:1];
        NetraPopupHeadline.lineBreakMode=NSLineBreakByCharWrapping;
        NetraPopupHeadline.backgroundColor=[UIColor redColor];
        NetraPopupHeadline.numberOfLines=0;
        NetraPopupHeadline.font=[UIFont fontWithName:@"HelveticaNeue-Bold" size:13];



    }
    [[self view] addSubview:NetraPopupPrice];

    [[self view] addSubview:NetraPopupProvider];
    [[self view] addSubview:NetraPopupSeparator];
    [[self view] addSubview:NetraPopupLocation];
    [[self view] addSubview:NetraPopupHeadline];
    return self;
}

-(void)viewDidLoad{
[super viewDidLoad];
    CGSize NetraLabelForPriceWidth = [[NetraPopupPrice text] sizeWithFont:[NetraPopupPrice font]];
    CGFloat NetraLabelForPriceW = NetraLabelForPriceWidth.width;

    NSLog(@"Width=%f",NetraLabelForPriceW);
}
-(void)viewWillAppear:(BOOL)animated{

}
- (void)viewDidUnload {

    [super viewDidUnload];
}

@end

and the result when log it

NSLog(@"Width=%f",NetraLabelForPriceW);

is:

[9858:19d03] Width=0.000000

it should be calculate right? anything wrong in my code?

  • 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-13T16:36:21+00:00Added an answer on June 13, 2026 at 4:36 pm

    Try logging the address of your NetraPopupPrice and its text in viewDidLoad. Also try “adding to Subview” inside the if(self) block of initWithNibName.

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

Sidebar

Related Questions

i have problems with a really basic thing. setting properties after instantiation a UIViewController-
I have two problems. I have to calculate two equations: X = A -
I have two UILabel in side of UICell , which contains dynamic text so
I have problems to calculate price with jquery in various price formats (depending on
I have the problems with my function which needs to calculate distance between given
I have two problems with append/prepend on JQuery. My code: function toselect(f,d){ $('#workcont').remove('h2').load('pages/' +
I have problems with timer. I have function in function (draw in func) void
I'm trying to calculate TimeSpans between dates. I have no problem with this if
I have problems with creating a simple Group-Box-Control via CreateWindowEx. The font-size/-style of its
I have problems with CSS. The table is creating white border and I do

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.