iphone - Sectioned tableview problem -


i have database app making , can extract results sqlite database , put them in table, need make them sort alphabetically in sections.

so have code

aarray = [[nsmutablearray alloc] init];     barray = [[nsmutablearray alloc] init];     carray = [[nsmutablearray alloc] init];     darray = [[nsmutablearray alloc] init];     earray = [[nsmutablearray alloc] init];     farray = [[nsmutablearray alloc] init];     garray = [[nsmutablearray alloc] init];     harray = [[nsmutablearray alloc] init];     iarray = [[nsmutablearray alloc] init];     jarray = [[nsmutablearray alloc] init];     karray = [[nsmutablearray alloc] init];     larray = [[nsmutablearray alloc] init];     marray = [[nsmutablearray alloc] init];     narray = [[nsmutablearray alloc] init];     oarray = [[nsmutablearray alloc] init];     parray = [[nsmutablearray alloc] init];     qarray = [[nsmutablearray alloc] init];     rarray = [[nsmutablearray alloc] init];     sarray = [[nsmutablearray alloc] init];     tarray = [[nsmutablearray alloc] init];     uarray = [[nsmutablearray alloc] init];     varray = [[nsmutablearray alloc] init];     warray = [[nsmutablearray alloc] init];     xarray = [[nsmutablearray alloc] init];     yarray = [[nsmutablearray alloc] init];     zarray = [[nsmutablearray alloc] init]; 

and have code move each item database relevant array, works fine.

i have code:

all = [nsmutabledictionary dictionarywithobjectsandkeys:aarray,@"a",barray,@"b",carray,@"c",darray,@"d",earray,@"e",farray,@"f",garray,@"g",harray,@"h",iarray,@"i",jarray,@"j",karray,@"k",larray,@"l",marray,@"m",narray,@"n",oarray,@"o",parray,@"p",qarray,@"q",rarray,@"r",sarray,@"s",tarray,@"t",uarray,@"u",varray,@"v",warray,@"w",xarray,@"x",yarray,@"y",zarray,@"z",nil];     allarray = [nsarray alloc];     allarray = [allarray initwitharray:[[all allkeys]sortedarrayusingselector:@selector(compare:)]]; 

and this

- (nsinteger)numberofsectionsintableview:(uitableview *)tableview {     // return number of sections.     return [allarray count]; }   - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section {     // return number of rows in section.     nsarray *array = [all objectforkey:[allarray objectatindex:section]];     return [array count]; } - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section {     int sectionindex = section;     return [allarray objectatindex:sectionindex];   } 

when run works fine, if scroll , down few times app crashes without error message. sections crashes when add them in, cannot see im doing wrong

everythings declared in h file , @property , @synthesize following

@property (nonatomic,retain) nsmutabledictionary *all; @property (nonatomic,retain) nsarray *allarray; @property (nonatomic, retain) uitableview *tableview; 

if me great!

thanks!

your dictionary "all" not seem retained. appear assign dictionary object directly instance variable, not property (in case have used self.all).

if app crashes without message, make sure enable breakpoints button in xcode's toolbar. run app in debugger, give more helpful information crash. setting nszombieenabled yes helps.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -