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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:22:45+00:00 2026-05-25T02:22:45+00:00

Hi, I want to implement a screen like in the image above. The data

  • 0

enter image description here

Hi, I want to implement a screen like in the image above. The data is coming from the server in the form of JSON string and I have parsed the data.

The code is as follows:

         UILabel *lblTitle  = [self createDynamicLabel:@"Seroquel"
                                           contentFrame:CGRectMake(10, 5, 150, 20) 
                                                  color:[UIColor blackColor] 
                                                   font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
        [scrollview addSubview:lblTitle];
        [lblTitle release];

        UILabel *lblGeneric       = [self createDynamicLabel:@"Generic Name:"
                                             contentFrame:CGRectMake(10, lblTitle.frame.size.height+5, 130, 20) 
                                                    color:[UIColor blackColor] 
                                                     font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
        [scrollview addSubview:lblGeneric];
        [lblGeneric release];

        UILabel *lblGenericName   = [self createDynamicLabel:DrugInfo.GenName
                                                contentFrame:CGRectMake(lblGeneric.frame.size.width+5, 24, 150, 20) 
                                                       color:[UIColor blackColor] 
                                                        font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
        [scrollview addSubview:lblGenericName];
        [lblGenericName release];

        UILabel *lblManufacturer  = [self createDynamicLabel:@"Manufacturer:"
                                                contentFrame:CGRectMake(10, 44, 115, 20) 
                                                       color:[UIColor blackColor] 
                                                        font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
        [scrollview addSubview:lblManufacturer];
        [lblManufacturer release];

        UILabel *lblManufacturerName = [self createDynamicLabel:DrugInfo.Mtr
                                                   contentFrame:CGRectMake(115, 43, 150, 20) 
                                                          color:[UIColor blackColor] 
                                                           font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
        [scrollview addSubview:lblManufacturerName];
        [lblManufacturerName release];

        //[self createDynamicView:CGRectMake(10, 70, 153, 128)];


        UILabel *lblCommon          = [self createDynamicLabel:@"Common uses:"
                                           contentFrame:CGRectMake(10, 209, 110, 20) 
                                                  color:[UIColor blackColor] 
                                                   font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
        lblCommon.backgroundColor   = [UIColor whiteColor];

        [lblCommon sizeToFit];
        [scrollview addSubview:lblCommon];
        [lblCommon release];

        NSString *genericInfo       = [NSString stringWithFormat:@"                        %@",DrugInfo.ComUse];
        UILabel *lblCommonUse       = [self createDynamicLabel:genericInfo
                                             contentFrame:CGRectMake(10, 208, 310, 80) 
                                                    color:[UIColor blackColor] 
                                                     font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];


        //[lblCommonUse sizeToFit];
        lblCommonUse.lineBreakMode  = UILineBreakModeWordWrap;
        lblCommonUse.numberOfLines  = 0;
        [scrollview addSubview:lblCommonUse];
        [lblCommonUse release];



        UILabel *lblBefore          = [self createDynamicLabel:@" Before Using:"
                                           contentFrame:CGRectMake(10, 294, 102, 20) 
                                                  color:[UIColor blackColor] 
                                                   font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
        [lblBefore sizeToFit];
        lblBefore.backgroundColor   = [UIColor whiteColor];
        [scrollview addSubview:lblBefore];
        [lblBefore release];

        genericInfo                 = [NSString stringWithFormat:@"                        %@",DrugInfo.BeforeUse];
        UILabel *lblBeforeUse       = [self createDynamicLabel:genericInfo
                                             contentFrame:CGRectMake(10, 290, 308, 120) 
                                                    color:[UIColor blackColor] 
                                                     font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
        lblBeforeUse.lineBreakMode  = UILineBreakModeWordWrap;
        lblBeforeUse.numberOfLines  = 0;
        [scrollview addSubview:lblBeforeUse];
        [lblBeforeUse release];


    }  
}
}   


-(UILabel *)createDynamicLabel:(NSString *)setTitle 
              contentFrame:(CGRect)labelFrame 
                     color:(UIColor *)labelColor 
                      font:(UIFont *)labelFont {

UILabel  *dynamicLabel = [[UILabel alloc] init];
dynamicLabel.frame     = labelFrame;
dynamicLabel.text      = setTitle;
dynamicLabel.textColor = labelColor;
dynamicLabel.font      = labelFont;
dynamicLabel.backgroundColor = [UIColor clearColor];
return dynamicLabel;
}

But if the data is more than can be displayed on the screen, it is clipping it and I want to display all the data. Can any one please help me do that?

Thanks in advance.

  • 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-25T02:22:45+00:00Added an answer on May 25, 2026 at 2:22 am

    First Off, from what I can see you are adding your UI controls to a UIScrollView, if that is the case you need to make sure you are setting the contentSize property of the UIScrollView. The UIScrollView does not know how big the content is hold, so you need to figure this out and tell the UIScrollView.

    This can be achieved quite easily if you set the frames for your controls using positioning variables (i.e CGFloat top; CGFloat left;) and update them as you add controls, instead of hardcoding the position values into your code. Something like this

    CGFloat top = 5;
    CGFloat left = 10;   
    UILabel *lblTitle  = [self createDynamicLabel:@"Seroquel"
                                           contentFrame:CGRectMake(left, top, 150, 20) 
                                                  color:[UIColor blackColor] 
                                                   font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
    [scrollview addSubview:lblTitle];
    [lblTitle release];
    
    top += lblTitle.frame.size.height;
    
    UILabel *lblGeneric       = [self createDynamicLabel:@"Generic Name:"
                                             contentFrame:CGRectMake(left, top, 130, 20) 
                                                    color:[UIColor blackColor] 
                                                     font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
    [scrollview addSubview:lblGeneric];
    [lblGeneric release];
    
    left += lblGeneric.frame.size.width;
    
    UILabel *lblGenericName   = [self createDynamicLabel:DrugInfo.GenName
                                                contentFrame:CGRectMake(left, top, 150, 20) 
                                                       color:[UIColor blackColor] 
                                                        font:[UIFont fontWithName:@"Arial-BoldMT" size:17]];
    [scrollview addSubview:lblGenericName];
    [lblGenericName release];
    

    Then at the end, you can use top to make a CGSize to set the contentSize.

    I also would suggest you look at using UITableView or using NSAttributedString as they might help you achieve what you want in other ways.

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

Sidebar

Related Questions

I want to implement a splash screen in my application, like if the username
I want to implement something like this using JSF.(part of search screen) More and
I want to implement in Java a class for handling graph data structures. I
I want to implement an ISAPI filter like feature using HttpModule in IIS7 running
I want to change the image in my application screen periodically. how can i
I want to implement the Augmented Reality with layer Example like this:-http://www.youtube.com/watch?v=b64_16K2e08 i had
My situation is like this, I want to programmatically take a print screen of
I want to create a slide-down animation, like in the image in the link.
I want to implement something like the Android Calendar week view, where you can
Assume you want to read an image file in a common file format from

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.