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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:12:20+00:00 2026-06-09T20:12:20+00:00

static NSString *cellIdentifier = @Cell; NSMutableArray *fields=[[NSMutableArray alloc] init]; MDSpreadViewCell *cell = [aSpreadView dequeueReusableCellWithIdentifier:cellIdentifier];

  • 0
static NSString *cellIdentifier = @"Cell";


NSMutableArray *fields=[[NSMutableArray alloc] init];

MDSpreadViewCell *cell = [aSpreadView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil) {
    cell = [[[MDSpreadViewCell alloc] initWithStyle:MDSpreadViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];

        for (i =0; i < N; i++){
        NSLog (@"tag = %i", i);

        [fields  addObject:[[UITextField alloc] initWithFrame:CGRectMake(10, 10, 185, 30)]];
        [[fields objectAtIndex:i] setTag:i];

        NSString *John =  [NSString stringWithFormat:@"%i", i];

             [[fields objectAtIndex:i] setText:John];

      [[fields objectAtIndex:i] setBackgroundColor:[UIColor redColor]];
        [[fields objectAtIndex:i] setDelegate:self];
        [[fields objectAtIndex:i] setUserInteractionEnabled:TRUE];
           viewWithTag:i]).text;
            [cell addSubview:[fields objectAtIndex:i]];
    }

    return cell;

What is output to the console is correct: Tag = 0, 1, 2, 3, etc., but every cell just says the last value in the array. I’ve tried putting the for statement in different locations as well as returning the cell in different blocks. I am sure it is something simple that I am overlooking.

  • 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-09T20:12:21+00:00Added an answer on June 9, 2026 at 8:12 pm

    This may only be a partially useful answer, since you have some other issues to consider that I don’t see addressed in the code snippet you’ve shown so far (most notably, that you’ll need some sort of Model, such as a multidimentional array, that holds the spreadsheet data independently of the table view, and also code that will update the Model when the user changes any of the values in the text fields.)

    But I think at this point you are just trying to create textfields in your table cells and get some numbers to appear in them. You might try something like this:

    static NSString *cellIdentifier = @"Cell";
    MDSpreadViewCell *cell = [aSpreadView dequeueReusableCellWithIdentifier:cellIdentifier];
    
    if (cell == nil) {
        cell = [[[MDSpreadViewCell alloc] initWithStyle:MDSpreadViewCellStyleDefault reuseIdentifier:cellIdentifier] autorelease];
    
        UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 10, 185, 30)]];
    
        textField.tag = 1;
        textField.backgroundColor = [UIColor redColor];
        textField.delegate = self;
        [textField setUserInteractionEnabled:YES];
    
        [cell addSubview:textField];
    }
    
    UITextField *textFieldForCell = [cell viewWithTag:1];
    int numberInCell = rowPath.row + columPath.column;
    textFieldForCell.text = [NSString stringWithFormat:@"%i", numberInCell];
    
    return cell;
    

    Just as a future note, it would have been helpful in your original question to indicate that you are using MDSpreadView

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

Sidebar

Related Questions

static NSString *CellIdentifier = @Cell; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@]; if (cell == nil)
Can someone explain the difference between static NSString* CellIdentifier = @Cell; and NSString *CellIdentifier
Edited code - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @Cell;
-(IBAction)btnSaveScore:(id)sender { if(!dictWinData) dictWinData = [[NSMutableDictionary alloc] init]; array = [NSMutableArray arrayWithObjects:txt_EnterName.text, [NSString stringWithFormat:@%i,iTap],
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @Cell2; UILabel *titleLabel;
(sorry for my english :-) I'm loading a custom UITableViewCell: static NSString *CellIdentifier =
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *TodoListTableIdentifier = @TodoListTableIdentifier; TodoTableViewCellController
I'm writing in my code, static const NSString *a = @HARDIk; this is in
This is my code. #import "States.h" @interface States () + (NSString *)statesFilePath; @end static
I have problem with using dequeueReusableCellWithIdentifier method. Whenever I use this one, one cell

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.