iphone - Deleting multiple (not yet loaded) rows in UITableView -


i'm having bit of trouble trying delete rows haven't been loaded (or not visible) uitableview.

my setup follows -

there 2 sections in tableview , each element in section 1 associated multiple elements section two.

to give example (the data isn't related i'm trying do, believe example doesn't require explanation)

section 1

  • bmw
  • acura
  • merc

section 2

  • 328i
  • 335i
  • rx
  • lx
  • tx
  • c300
  • c550

my internal model goes -

nsmutablearray cars[] nsmutablearray models[]  cars[0] = "bmw" cars[1] = "acura" cars[2] = "merc" 

each element in models[] vector , conents listed below

models = [ ["328i", "335i"], ["rx", "lx", "tx"], ["c300", "c550"] ];

so functionality i'm trying build. if user clicks delete , tries delete bmw, app needs remove entry bmw section 1 , entries 328i , 335i in section two. however, user free delete single row of section 2 independently.

can point me way can proceed this?

nsmutablearray *cars = [[nsmutablearray alloc] initwithobjects:@"bmw",@"acura",@"merc",nil];

nsmutablearray *arr1 = [[nsmutablearray alloc]initwithobjects:@"328i", @"335i",nil]; nsmutablearray *arr2 = [[nsmutablearray alloc]initwithobjects:@"rx", @"lx", @"tx",nil]; nsmutablearray *arr3 = [[nsmutablearray alloc]initwithobjects:@"c300", @"c550",nil];  nsmutablearray * models = [[nsmutablearray alloc] initwithobjects:arr1,arr2,arr3,nil]; 

on delete if delete bmw remove 1st element models array , and 1st element cars array , reload table. i.e.

[cars removeobjectatindex:0]; [models removeobjectatindex:0]; [tableview reload];     //tableview - object of uitableview 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -