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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:57:32+00:00 2026-05-18T23:57:32+00:00

I have the following code: desc = [[UILabel alloc] initWithFrame:CGRectMake(134, 5, 185, 60)]; [desc

  • 0

I have the following code:

desc = [[UILabel alloc] initWithFrame:CGRectMake(134, 5, 185, 60)];
[desc setNumberOfLines:20];
[dataView addSubview:desc];
desc.text =@"1111\n2222\n3333\n4444\n5555\n6666\n7777\n8888" ;

the data is not fitting in the label so I see something like:

1111
2222
3333
4444…

I also a button that when you click it i want to expand the label so all the data is visible. For that I have the following code:

CGSize newDescSize = [desc.text sizeWithFont:[UIFont italicSystemFontOfSize:12] constrainedToSize:CGSizeMake(185, 400)];

[UIView beginAnimations:@"expandDesc" context:nil];
[UIView setAnimationDuration:1.0];

CGRect frame = desc.frame;
frame.size.height=newDescSize.height;
desc.frame=frame;

[UIView commitAnimations];

It works fine except that the animation starts from the view:

3333
4444
5555
6666

and while expanding both lines are added on the bottom and the top, so the animation is not smooth, I want the the text will expand from the original text and lines will be added at the bottom.

does anyone know what i’m doing wrong?

  • 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-18T23:57:33+00:00Added an answer on May 18, 2026 at 11:57 pm

    Nothing is wrong. The -drawRect: method of the UILabel is optimized so that It doesn’t draw outside its bounds. This, simply put, means that you won’t have a smooth transition for it, it will jerk from both ends. Without using a custom class, I don’t know what you can do.

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

Sidebar

Related Questions

No related questions found

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.