Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
I´m having a problem when trying to delete the right row in my tableview. I have 3 dynamic created cells grouped, and also, i´m using the editing mode. Everything is working fine when adding more rows in each section, but when i try to delete a specific row in a specific section, it does´t work correctly. Let´s say that i have added rows 1,2,3 (besides de original one) and i want to delete number 2, it works for the first time, but then it gets stuck!!. I have also a method that gives automatically a tag for each new row created. I think my problem is that the row.tag in the tableview are not matching with the ones in my array(i have an array receiving the inserted cells, and it should work with the deleted ones!!!). Here is my code:
There is no reason to keep an array of cells. You might want to read through the table view link in my signature.
Hello Brian
First of all let me thank you for replying to my post, your tutorials are great!!. But i don´t understand why do you say not to keep an array of cells and then in your tutorials you write:
We will remove a row, therefore we must remove something from the array at the same time.
Replies
SlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeFirst of all let me thank you for replying to my post, your tutorials are great!!. But i don´t understand why do you say not to keep an array of cells and then in your tutorials you write:
We will remove a row, therefore we must remove something from the array at the same time.
What am i missing?!
Thanks again
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeThanks for answering, i think i need to show you some more of my code:
I have inserting new cells like this:
else if (editingStyle == UITableViewCellEditingStyleInsert)
{
switch(indexPath.section)
{
case 0:
if(indexPath.row==0 && indexPath.section==0)
{
static NSString *cellType1 = @"cellType1";
UITableViewCell *cell = [TableView dequeueReusableCellWithIdentifier:cellType1];
cell.tag=[self Maxtaginsection:0];
[myarray insertObject:cell atIndex:[myarray count]];
[Table reloadData];
}
break;
case 1:
if(indexPath.row==0 && indexPath.section==1)
{
static NSString *cellType2= @"cellType2";
UITableViewCell *cell = [TableView dequeueReusableCellWithIdentifier:cellType2];
cell.tag=[self Maxtaginsection:1];
[myarray insertObject:cell atIndex:[myarray count]];
[Table reloadData];
}
break;
etc....
i´m giving a tag for each new cell like this:
- (NSInteger) Maxtaginsection:(NSInteger)section
{
int i=0,Maxtag=0;
for (i=0; i < myarray.count; i++) {
UITableViewCell *aux=[myarray objectAtIndex:i];
if (aux.tag >= 100 && aux.tag < 200 && section==0) {
if(Maxtag < aux.tag)
Maxtag=aux.tag;
}
if (aux.tag >= 200 && aux.tag < 300 && section==1) {
if(Maxtag < aux.tag)
Maxtag=aux.tag;
}
if (aux.tag >= 300 && section==2) {
if(Maxtag < aux.tag)
Maxtag=aux.tag;
}
}
return Maxtag+1;
}
Should i stop inserting cells in a array?. (sorry, newbie)!.
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like AwesomeSlickShopper 2 | BTIConcepts on GitHub | Free NSLog utility | Free Getter Utility | Leave a PayPal donation.
Are you a newbie? Things you should read:
Definitive Guide To Properties | UITableView Series | A Model (Object) Is A Beautiful Thing
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome