Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AbhishekApple

macrumors member
Original poster
Aug 5, 2010
86
0
Is the following thing possible...
indexed list on left side....(AA,AB,AC,AD......)

iphone.JPG
 
Possible? I suspect that it could be done using a custom view that you write yourself, resizing the table view to allow space for it and writing code to supply a datasource to it and a load of glue code to interact with the table.
 
Possible? I suspect that it could be done using a custom view that you write yourself, resizing the table view to allow space for it and writing code to supply a datasource to it and a load of glue code to interact with the table.

Thanks for that quick reply...
can i find some help in apples site with the normal indexed list creation
 
Thanks for that quick reply...
can i find some help in apples site with the normal indexed list creation

I doubt it. For the normal index you just have to supply a list a character for each section and Apple's code (which you can't see) does all the work. If you want an odd interface like that you are basically on your own.
 
I doubt it. For the normal index you just have to supply a list a character for each section and Apple's code (which you can't see) does all the work. If you want an odd interface like that you are basically on your own.

I have used another idea to execute the functionality..
=> on click of the indexed list (A,B,C,D....) the indexed list will be regenerated with new value i.e AA,AB,AC,AD....
=> and when the user clicks the refresh button (on navigation bar) again original indexed list will be generated (A,B,C,D....)

Now i am stuck with following thing,
=>the following code executes perfectly for the first time but it gives EXC_Bad_access...(their are no leaks, i have checked)

error is thrown on the following line marked red
and i doubt on char conversion marked orange

but it works when the table loads for first time but crashes when reloads...
Code:
//dblIndex is used for AA,AB,Ac series and else part for A,B,C..

NSSTring *sortVal;

- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
	
	if(searching)
		return -1;
	else if(dblIndex) {
		return index;
	}
	else {
		dblIndex=YES;
		sortVal=nil;
		//unichar c = index+65;
		//sortVal = (NSString*)c;
		[COLOR="DarkOrange"]sortVal=[NSString stringWithFormat:@"%c",index+65];[/COLOR]
		[Dictionary arrySortContactsRemoveAll];
		[Dictionary showSortContacts:sortVal];
		[tblView reloadData];
		return 0;
	}
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
	
	if(searching)
		return @"Search Result";
	else if(dblIndex){
		
			NSLog(@"%d",section);
		NSArray *dblary =[[Dictionary getarrySortContacts] objectAtIndex:section];
		if ([dblary count]==0) {
			return nil;
		}
		
     [B][COLOR="red"]NSLog(@"%@",sortVal);[/COLOR][/B]
	return [NSString stringWithFormat:@"%c",section+65];
	
	
	}
	else {
		NSArray *ary =[[Dictionary getarryContacts] objectAtIndex:section];
		//NSLog(@"%d",section);
		if ([ary count]==0) {
			return nil;
		}
			
		return [NSString stringWithFormat:@"%c",section+65];
	}
}
 
Last edited:
I suggest you need to read the basic Memory Management Guide on the developer site. You clearly do not know when a method is returning an autoreleased object and when it isn't (hint your Orange line is returning an autoreleased object that you are not retaining so when you try and access this later it no longer exists: basic schoolboy error).

Oh and please don't PM me asking me to help you: I'll decide where and when to post thank you.
 
Now i am stuck with following thing,
=>the following code executes perfectly for the first time but it gives EXC_Bad_access...(their are no leaks, i have checked)

Running your program with zombies enabled will find most of these under-retain or over-release errors.

http://meandmark.com/blog/2010/09/using-nszombie-with-instruments/
http://www.cocoadev.com/index.pl?NSZombieEnabled
http://www.corbinstreehouse.com/blo...debug-those-random-crashes-in-your-cocoa-app/
http://www.iphonedevsdk.com/forum/iphone-sdk-development/9781-trouble-setting-nszombieenabled.html

Everyone should run their program with zombies enabled at least once a week.
This does two things:
1. It alerts you to any hidden under-retain problems before they cause a crash.
2. It teaches you how to use the feature, so when you need it (and you inevitably will) you already know how to use it.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.