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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:23:14+00:00 2026-06-04T03:23:14+00:00

I am having a NSArray of size 11 as it formed below. labels =

  • 0

I am having a NSArray of size 11 as it formed below.

labels = [NSMutableArray arrayWithObjects:@"DIN #",@"Brand Name",@"Full Name",
@"Strength",
@"Medication Type",
@"Presciption ID",
@"Next Dosage",
@"Required Dosage",
@"ada",
@"dasdada",
@"dasdasad",
nil];

but when i am displaying this array in tableview cell Using this code.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {static NSString *CellIdentifier = @"Cell";
  UITableViewCell *cell = [tableView dueueReusableCellWithIdentifier:CellIdentifier];   
UILabel* nameLabel = nil;

if(cell == nil) {   cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];nameLabel = [[UILabel alloc] initWithFrame:CGRectMake( 7.0, 10.0, 160.0, 44.0 )];

    nameLabel.text =[labels objectAtIndex:indexPath.row]; 


    nameLabel.lineBreakMode = UILineBreakModeWordWrap;

    nameLabel.numberOfLines =0;
    [nameLabel sizeToFit];
    CGSize expectedlabelsize = [nameLabel.text sizeWithFont:nameLabel.font constrainedToSize:nameLabel.frame.size lineBreakMode:UILineBreakModeWordWrap];
    CGRect newFrame =nameLabel.frame;
    newFrame.size.height =expectedlabelsize.height;


   [cell.contentView addSubview: nameLabel];

return cell;}

O/P is as below .

DIN

Brand Name

Full Name

Strength

Medication Type

Presciption ID

Next Dosage

Required Dosage

DIN

Brand Name

Full Name

see after required Dosage again DIN,Brand Name,Full Name showing ,which are already shown

  • 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-04T03:23:15+00:00Added an answer on June 4, 2026 at 3:23 am

    Use viewWithTag method and i have used it following method. Try like this. I think it will be helpful to you.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    
        static NSString *CellIdentifier = @"myCell";
        UILabel* nameLabel = nil;
        UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
        if(cell == nil)
        {
    
            cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    
        }
        else
        {
            UILabel *titleLbl = (UILabel *)[cell viewWithTag:1];
            [titleLbl removeFromSuperview];
        }
        nameLabel = [[UILabel alloc] initWithFrame:CGRectMake( 7.0, 10.0, 160.0, 44.0 )];
        nameLabel.text = [labels objectAtIndex:indexPath.row];
    
        nameLabel.lineBreakMode = UILineBreakModeWordWrap;
        nameLabel.tag =1;
        nameLabel.numberOfLines =0;
        [nameLabel sizeToFit];
        CGSize expectedlabelsize = [nameLabel.text sizeWithFont:nameLabel.font constrainedToSize:nameLabel.frame.size lineBreakMode:UILineBreakModeWordWrap];
        CGRect newFrame =nameLabel.frame;
        newFrame.size.height =expectedlabelsize.height;
        [cell.contentView addSubview: nameLabel];
        return cell;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What I am having so far right now is NSArray *keys = [NSArray arrayWithObjects:@firstName,@lastName,@phoneNumber,@email,@password,nil];
I am having an array like fallowing, NSArray*array = [NSArray arrayWithObjects:@1.1 something, @1.2 something
I am having trouble with compatibility between NSArray and NSMutableArray? --> Incompatible Objective-C types
I'm having the code as below. - (void)viewDidLoad { NSArray* myarr = [self createArray];
I am having problems initalizing an NSArray and adding integers to it. Here is
I'm having a problem with adding objects to an NSArray in iPhone SDK. The
In my application, I'm having NSArray that holds objects of NSDictionary. In each dictionary,
I am having a bit of trouble navigating around an NSArray . My array:
I am having an Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSArray
instead of having the name of the view to show up in the middle

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.