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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:46:26+00:00 2026-05-31T09:46:26+00:00

I am trying to implement UITableView based Application.For that I select UITableViewStyle is Group.In

  • 0

I am trying to implement UITableView based Application.For that I select UITableViewStyle is Group.In my TableView their is 15 section each section having 1 row.

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 15;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return 1;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section==12) 
    {
        return 120;
    }
    else
    {
        return 60;
    }

}

I want add a UITextView on Section 12

For that i did following code

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];



    }
    if ([indexPath section] == 12) 
    {
        if([indexPath row]==0)
        {
            descriptionTextField=[[UITextView alloc] initWithFrame:CGRectMake(5, 8, 290, 106)];
            descriptionTextField.font = [UIFont systemFontOfSize:15.0];   
            descriptionTextField.backgroundColor=[UIColor scrollViewTexturedBackgroundColor];

            [descriptionTextField setDelegate:self];
            [descriptionTextField setTag:2];
            [descriptionTextField setText:@"Enter Location Description."];

            descriptionTextField.keyboardType=UIKeyboardTypeDefault;
            descriptionTextField.returnKeyType=UIReturnKeyNext;


            descriptionTextField.textColor=[UIColor blackColor];
            descriptionTextField.editable=YES;
            descriptionTextField.autocapitalizationType=UITextAutocapitalizationTypeWords;
            descriptionTextField.autocorrectionType=UITextAutocorrectionTypeDefault;
            descriptionTextField.textAlignment=UITextAlignmentLeft;

            UIToolbar*  keboardToolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 32)];

            UIBarButtonItem *extra=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
            UIBarButtonItem *Done=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(keyboardDoneButtonActin:)];
            [Done setWidth:65.0f];
            [keboardToolBar setItems:[[[NSArray alloc]initWithObjects:extra,Done, nil]autorelease] ];
            [extra release];
            [Done release];

            [keboardToolBar setTintColor:[UIColor blackColor]];
            [keboardToolBar setAlpha:.70];
            [descriptionTextField setInputAccessoryView:keboardToolBar];
            [descriptionTextField setTag:101];
            [cell.contentView addSubview:descriptionTextField];
            [descriptionTextField release];
        }
    }

    return cell;
}

In the initil stage the table view like this

enter image description here

if i am scrolling tableview up and down , then the uitextView section changed and it will display multiple location.

enter image description here

I can’t understand my fault, why this happend?

if am implementing the above code in side the if(cell==nil)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
   if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

    if ([indexPath section] == 12) 
    {
        if([indexPath row]==0)
        {
           **/* implemention  all code here*/**

             [cell.contentView addSubview:descriptionTextField];
            [descriptionTextField release];
        }
    }

    return cell;

}

UITextView not disply, i think it is not allocating.

so what is the difference between code implementing in
if (cell == nil)
{
inside
}

if (cell == nil)
{
}
out side

  • 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-31T09:46:27+00:00Added an answer on May 31, 2026 at 9:46 am
    NSString *CellIdentifier = [NSString stringWithFormat:@"%i",indexPath.row];
    
    // Dequeue or create a cell of the appropriate type.
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    

    This can be used instead of

    static NSString *CellIdentifier = @"Cell";
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    

    this is the simple example to write inside the cell ==nill

    - (UITableViewCell *)tableView:(UITableView *)tableView1 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *CellIdentifier = @"CellIdentifier";
    // Dequeue or create a cell of the appropriate type.
    UITableViewCell *cell = [tableView1 dequeueReusableCellWithIdentifier:CellIdentifier];
    cell= nil;
    if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
        [[cell.contentView viewWithTag:100+indexPath.row] removeFromSuperview]; 
    
        UIView *selectview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, cell.frame.size.width, 30)];
        [selectview setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"strip_s12A-1_h.png"]]];
        cell.selectedBackgroundView = selectview;
        [selectview release];
    
        UILabel *cellTitle=[[UILabel alloc]initWithFrame:CGRectMake(40, 0, 300, 30)];
        //cellTitle.adjustsFontSizeToFitWidth=YES;
        [cellTitle setBackgroundColor:[UIColor clearColor]];
        [cellTitle setFont:[UIFont fontWithName:@"Arial Rounded MT Bold" size:17]];
        [cellTitle setTextColor:[UIColor blackColor]];
        cellTitle.tag = 100+indexPath.row;
    
            cellTitle.text= [[[cellArray objectAtIndex:indexPath.section]objectAtIndex:indexPath.row] valueForKey:@"Des2"];
    
        [cell.contentView addSubview:cellTitle];
    
        [cellTitle release];
    }
    return cell;
         }
    

    i think will be enough right

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

Sidebar

Related Questions

I am trying to implement UITableview based application. In my tableView their is 10
I am trying to implement -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath So far this is what
I'm currently trying to implement a UITableView with a delegate and data source that
I am trying to implement a Core Data backed UITableView that supports indexing (eg:
Trying to implement a UITableView of names similar to the built-in Contacts iPhone app
when trying to implement an Aspect, that is responsible for catching and logging a
I'm trying to implement a UISearchBar within a UITableView , which behaves like the
I'm currently trying to implement a editable details view using a grouped UITableView. I'd
I am trying to figure out implement a Compose New Message view that works
I'm trying to make my Core data backed UITableView have reorder ability, After implement

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.