Array goes empty in DidSelectRowAtIndexPath - iphone

I have in my coreDatabase an entity "Day". In a method I fetch the data from that entity and put it in a mutuableArray dayObjects. You can see the code over here.
NSManagedObjectContext *context = [RKManagedObjectStore defaultStore].persistentStoreManagedObjectContext;
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:#"Day"];
NSPredicate *predicate = [NSPredicate predicateWithFormat:
#"p_date >= %# and p_date <= %#",dateString,dateString2];
[fetchRequest setPredicate:predicate];
NSSortDescriptor *descriptor = [NSSortDescriptor sortDescriptorWithKey:#"p_id" ascending:YES];
fetchRequest.sortDescriptors = #[descriptor];
NSArray *matches = [context executeFetchRequest:fetchRequest error:nil];
NSLog(#"matches = %#",[matches valueForKey:#"p_date"]);
arrDateObjects = [matches mutableCopy];
In my cellForRow I do this
Day *objDay = [arrDateObjects objectAtIndex:indexPath.row-1];
Cell.titlelabel.text = day.p_from;
In my tableview the data is showed correctly. The problem is dat when I do the same thing in my DidSelectRowAtIndexPath. I always get a Null when I log day.p_from.
Can anybody help me ?
EDIT
My numberOfSections
(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
int sections = 0;
sections = 1;
return sections;
}
My numberOfRowsInSection
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
int rows = 0;
rows = 8; //showing 7 days + 1 row for a little title
return rows;
}
My CellForRowAtIndexPath
static NSString *simpleTableIdentifier = #"OpeningCell";
OpeningCell *cell = (OpeningCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"OpeningCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
if(indexPath.row == 0){
cell.lblDay.text = NSLocalizedString(#"lblDag", nil);
cell.lblFrom.text = NSLocalizedString(#"lblVan", nil);
cell.lblTill.text = NSLocalizedString(#"lblTot", nil);
}else{
Day *objDay = [arrDateObjects objectAtIndex:indexPath.row-1];
NSLog(#"Day object in cell from = %#",objDay.p_from);
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:#"YYYY-MM-dd"];
NSDate *date = [dateFormat dateFromString:objDay.p_date];
NSDateFormatter *dateFormat2 = [[NSDateFormatter alloc] init];
[dateFormat2 setDateFormat:#"dd/MM"];
NSString *dateString = [dateFormat2 stringFromDate:date];
NSLog(#"date: %#", dateString);
cell.lblShort.text = dateString;
cell.lblDay.text = [arrDays objectAtIndex:indexPath.row-1];
NSString *txtFrom = [objDay.p_from substringWithRange:NSMakeRange(0, 5)];
cell.lblFrom.text = txtFrom;
NSString *txtTill = [objDay.p_till substringWithRange:NSMakeRange(0, 5)];
cell.lblTill.text = txtTill;
}
return cell;

NSLog(#"matches = %#",[matches valueForKey:#"p_date"]);
arrDateObjects=[[NSMutableArray alloc]init];
[arrDateObjects addobject:[matches objectAtindex:indexpath.row-1]];
Instead of
NSLog(#"matches = %#",[matches valueForKey:#"p_date"]);
arrDateObjects = [matches mutableCopy];

//try
arrDateObjects = [NSMutableArray arrayWithArray:matches];
//instead of
arrDateObjects = [matches mutableCopy];

Related

App suddenly crashes on an NSLog of my NSMutableArray

I have a very strange problem. I've made an app, everything works ok.
But now it suddenly crashes on my NSMutableArray.
Here is a screenshot of the situation
A few days ago everything worked normal. Can it be that this comes because of the update of XCODE and IOS 7 or is it something else?
Can somebody help me? if you need more detailed information. Please ask.
EDIT
The array comes from a mutableCopy of my fetchRequest results.
NSArray *matches = [context executeFetchRequest:fetchRequest error:nil];
newsArray = [matches mutableCopy];
EDIT 2
-(void)fetchNews{
newsArray = [[NSMutableArray alloc]init];
RKManagedObjectStore *store = [[TerbremeDataModel sharedDataModel] objectStore];
NSManagedObjectContext *context = store.mainQueueManagedObjectContext;
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:#"News"];
NSSortDescriptor *descriptor = [NSSortDescriptor sortDescriptorWithKey:#"new_id" ascending:NO];
fetchRequest.sortDescriptors = #[descriptor];
NSArray *matches = [context executeFetchRequest:fetchRequest error:nil];
newsArray = [matches mutableCopy];
[tableview reloadData];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = #"NewsCell";
NewsCell *cell = (NewsCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:#"NewsCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"tablecellbg.png"]];
cell.accessoryView = [[ UIImageView alloc ] initWithImage:[UIImage imageNamed:#"tableArrow.png" ]];
News *news = [newsArray objectAtIndex:indexPath.row];
NSLog(#"news is %#",news);
static NSDateFormatter *df;
static NSDateFormatter *df2;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
df = [[NSDateFormatter alloc] init];
[df setDateFormat:#"yyyy-MM-dd HH:mm:ss"];
df2 = [[NSDateFormatter alloc] init];
[df2 setDateFormat:#"d MMMM yyyy"];
});
cell.lblText.font = [UIFont fontWithName:#"GillSans" size:15.0];
cell.lblDate.font = [UIFont fontWithName:#"GillSans" size:15.0];
cell.lblDate.textColor = [UIColor colorWithRed:(154/255.0) green:(202/255.0) blue:(0/255.0) alpha:100];
cell.lblText.text = news.new_title;
NSDate *date = [df dateFromString:news.new_datepublished];
cell.lblDate.text = [df2 stringFromDate:date];
return cell;
}
If you are using ARC I would assign the newsArray using the objective c facilities, i.e. the generated accessor method.
So it would be
self.newsArray = [[NSMutableArray alloc]init];

how can print array json values into uitableview in iphone

JSON format code looks like this:
{
"rates": {
"amc": "201",
"hyd": "500.50",
"guj": "200.10",
"afgd": "400"
}
}
After parsing JSON values the above code array returns:
array = [values valueForKey:#"rates"];
which array return
{
amc = "201";
hyd = "500.50";
guj = "200.10";
afgd = "400";
...........etc
}
But i want to print in UITableView look amc:201
How can i do this?
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[connection release];
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
self.responseData = nil;
values = [responseString JSONValue];
array = [[NSMutableArray alloc] init];
NSMutableArray *arrTitle = [[NSMutableArray alloc] init];
NSMutableArray *arrValues = [[NSMutableArray alloc] init];
array =[values valueForKey:#"rates"];
NSLog(#"array values:--> %#",array);
// NSLog(#"values:--> %#",values);
// NSLog(#"Particular values:--> %#",[[values valueForKey:#"rates"] valueForKey:#"AED"]);
tempDict1 = (NSMutableDictionary *)array;
NSArray *arr;// =[[NSArray alloc]init];
arr = [[tempDict1 valueForKey:#"rates"] componentsSeparatedByString:#";"];
NSLog(#"arr-->%#",arr);
NSString *subStar = #"=";
[arrTitle removeAllObjects];
[arrValues removeAllObjects];
for (int i=0; i<[arr count]-1; i++)
{
[arrTitle addObject:[[arr objectAtIndex:i] substringToIndex:NSMaxRange([[arr objectAtIndex:i] rangeOfString:subStar])-1]];
[arrValues addObject:[[arr objectAtIndex:i] substringFromIndex:NSMaxRange([[arr objectAtIndex:i] rangeOfString:subStar])]];
NSLog(#"arrTitle is:--> %#",arrTitle);
}
tempDict1 = (NSMutableDictionary*)[array objectAtIndex:0];
array = [values valueForKey:#"rates"];
NSLog(#"tempDict--%#",[tempDict1 objectForKey:#"AED"]);
[array retain];
[tbl_withData reloadData];
}
try:
NSMutableArray * array2=[[NSMutableArray alloc]init];
[array addObject: [[array objectAtIndex:0] objectForKey:#"amc"]];
[array addObject: [[array objectAtIndex:0] objectForKey:#"hyd"]];
[array addObject: [[array objectAtIndex:0] objectForKey:#"guj"]];
[array addObject: [[array objectAtIndex:0] objectForKey:#"afgd"]];
now put array2 values in your table cell.
like:
cell.text=[array2 objectAtIndex:indexPath.row];
try this:-
NSDictionary *dict =[values valueForKey:#"rates"];
NSString *str=[dict valueForKey:#"amc"];
You need to do this:-
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
self.responseData = nil;
values = [responseString JSONValue];
NSMutableArray *arrTitle = [[NSMutableArray alloc] init];
NSMutableArray *arrValues = [[NSMutableArray alloc] init];
NSDictionary *dict =[values valueForKey:#"rates"];
NSString *str=[dict valueForKey:#"amc"];
rest you can do according to your requirements.
Return type for [values valueForKey:#"rates"] is a dictionary not array of values.
NSDictionary *dict = [values valueForKey:#"rates"];
Now you can refer get values within dictionary using objectForKey
Or else if you want to store in array.
NSMutableArray *array = [NSMutableArray array];
for (NSString *key in [dict allKeys])
{
array = [dict objectForKey:key];
}
So finally array has all the values within dictionary.
// returns no of rows
-(NSInteger) tableView: (UITableView *) tableView numberOfRowsInSection: (NSInteger) section
{
return [array count];
}
// contents of row will be
-(UITableViewCell*) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath
{
static NSString *CellIdentifier = #"test";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell...
NSString *value = [self. array objectAtIndex:indexPath.row];
cell.textLabel.text = value;
return cell;
}

how to display array of dictionaries in a tableview in iphone

hi friend i want display firstname and lastname both on cell but only firstname is displaying i try answer some one given me this link
This is the code used to obtain the 1st letter of each US State(stateName) in order to group them together alphabetically:
personarray = [[NSMutableArray alloc]init];
[personarray addObjectsFromArray:dislist.Peoplelistarray];
//short the personarray value:
NSSortDescriptor *asortDescriptor;
asortDescriptor=[NSSortDescriptor sortDescriptorWithKey:#"FirstName" ascending:YES selector:#selector(caseInsensitiveCompare:)];
//asortDescriptor=[[NSSortDescriptor alloc]initWithKey:#"TagName" ascending:YES];
NSArray *sortDescriptors=[NSArray arrayWithObject:asortDescriptor];
[self.personarray sortUsingDescriptors:sortDescriptors];
//---create the index---
Frstname = [[NSMutableArray alloc] init];
//check
NSMutableArray *tempArray = [[NSMutableArray alloc] init];
for (NSDictionary *row in personarray) {
[tempArray addObject:[row valueForKey:#"FirstName"]];
for (int i=0; i<[tempArray count]; i++){
char alphabet = [[tempArray objectAtIndex:i] characterAtIndex:0];
NSString *uniChar = [NSString stringWithFormat:#"%C", alphabet];
if (![Frstname containsObject:uniChar]){
[Frstname addObject:uniChar];
}
I am having issues understanding how to populate a tableview cell with BOTH the #“FirstName" and #“LastName"(as the subtitle) after I use NSPredicate to sort the array
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [Mytableview dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
if (isSearchOn) {
NSString *cellValue = [searchResult objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
}
else {
//---get the letter in the current section---
NSString* alphabet = [Frstname objectAtIndex:[indexPath section]];
//---get all states beginning with the letter---
NSPredicate *predicate =
[NSPredicate predicateWithFormat:#"SELF beginswith[c] %#", alphabet];
NSArray *Names = [[personarray valueForKey:#"FirstName"] filteredArrayUsingPredicate:predicate];
if ([Names count]>0) {
//---extract the relevant firstname from the Names object---
NSString *cellValue = [Names objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue;
}
How about something like this, at the end of your code:
NSArray *firstNames = [[personarray valueForKey:#"FirstName"] filteredArrayUsingPredicate:predicate];
NSArray *lastNames = [[personarray valueForKey:#"LastName"] filteredArrayUsingPredicate:predicate];
if ([firstNames count]>0) {
//---extract the relevant firstname from the Names object---
NSString *firstName = [firstNames objectAtIndex:indexPath.row];
NSString *lastName = [lastNames objectAtIndex:indexPath.row];
NSString *cellValue = [NSString stringWithFormat:#"%# %#",firstName, lastName];
cell.textLabel.text = cellValue;
}

Create a running sum in a UITableView

I have a UITableView populated (previously saved via a button in navbar), with transactions. Each row has five UILabel: date, description, person, value (deposits and withdraws) balance. The table is sort by date. How can I obtain the daily balance? The balance is the sum (+ and -) from the first input up to the current row.
I have the following code (JournalDetail.m), but I only get the same amount as value, instead of a cumulative amount (balance)
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = #"Cell";
GxPolizasL *cell = (GxPolizasL *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:#"GxPolizasL" owner:self options:nil];
cell = gxPolizasL;
self.gxPolizasL = nil;
GMDiario *gmDiarioy = (GMDiario *)[self.fetchedResultsController objectAtIndexPath:indexPath];
//Date value
NSDateFormatter* df = [[NSDateFormatter alloc] init];
[df setDateFormat:#"dd/MM/yy"];
cell.fechao.text = [df stringFromDate:gmDiarioy.pzFecha];
[df release];
//Description value
cell.referencia.text=gmDiarioy.pzAlias;
//Person value
cell.item.text = gmDiarioy.persona.prAlias;
//Transaction value
NSNumberFormatter* vf = [[NSNumberFormatter alloc] init];
[vf setNumberStyle:NSNumberFormatterCurrencyStyle];
cell.valuem.text= [vf stringFromNumber: gmDiarioy.pzMont01];
[vf release];
//This is where the balance value is intended to be created
NSDecimalNumber *saldoAc = [NSDecimalNumber decimalNumberWithString:#"0.0"];
NSDecimalNumber *objectExpenseNumber = [gmDiarioy valueForKeyPath:#"pzMont01"];
saldoAc = [saldoAc decimalNumberByAdding:objectExpenseNumber];
NSLog(#"saldoAc: %#",saldoAc);
NSNumberFormatter* af = [[NSNumberFormatter alloc] init];
[af setNumberStyle:NSNumberFormatterCurrencyStyle];
cell.valuea.text= [af stringFromNumber: saldoAc];
[af release];
}
return cell;}
Could you help me to figure out which is the correct way to implement balance value? Thanks in advance. Your help is greatly appreciated.
This is the code for self.fetchedResultsController
- (NSFetchedResultsController *)fetchedResultsController
{
if (__fetchedResultsController != nil) {
return __fetchedResultsController;
}
NSFetchRequest *fetchRequest = [[[NSFetchRequest alloc] init] autorelease];
//Diario is an entity that keeps all transactions
NSEntityDescription *entity = [NSEntityDescription entityForName:#"Diario" inManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];
[fetchRequest setFetchBatchSize:20];
//This is to select only the journals for the current account (value passed at didSelectRowAtIndexPath from the previous UItableView
NSString *filtro=gmCuenta.cnAlias;
NSPredicate *predicate = [NSPredicate predicateWithFormat:#"cuenta.cnAlias like %#", filtro];
NSLog(#"NSPredicate1 %#", gmDiario.cuenta);
[fetchRequest setPredicate:predicate];
NSSortDescriptor *sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:#"pzFecha" ascending:YES] autorelease];
NSArray *sortDescriptors = [NSArray arrayWithObjects:sortDescriptor, nil];
[fetchRequest setSortDescriptors:sortDescriptors];
NSFetchedResultsController *aFetchedResultsController = [[[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:nil] autorelease];
aFetchedResultsController.delegate = self;
self.fetchedResultsController = aFetchedResultsController;
NSError *error = nil;
if (![self.fetchedResultsController performFetch:&error]) {
NSLog(#"Unresolved error %#, %#", error, [error userInfo]);
abort();}
return __fetchedResultsController;
}
Basically what you want to do is this: Each time cellForRowAtIndexPath: gets called you want to loop through your data source array and sum all the values starting at the beginning of the array and ending with the array item equal to the row # (i.e. indexPath.row) of the cell in question. That will give you a running total (balance).
NSDecimalNumber *saldoAc = [NSDecimalNumber decimalNumberWithString:#"0.0"];
for (int i=0; i <= indexPath.row; i++) {
NSIndexPath *indexPath = [NSIndexPath indexPathWithIndex:i];
GMDiario *tempObj = (GMDiario *)[self.fetchedResultsController objectAtIndexPath:indexPath];
NSDecimalNumber *objectExpenseNumber = [tempObj valueForKeyPath:#"pzMont01"];
saldoAc = [saldoAc decimalNumberByAdding:objectExpenseNumber];
}
NSNumberFormatter* af = [[NSNumberFormatter alloc] init];
[af setNumberStyle:NSNumberFormatterCurrencyStyle];
cell.valuea.text= [af stringFromNumber: saldoAc];
[af release];
One other comment - you should be setting the values of your cell's subviews after you exit the if (cell == nil) block. Otherwise you will run into trouble when your tableView starts scrolling.

Cell's String Text Not Being Updated When 'Reload Table"

My cells' string text (TDBadgedCell) is only updated when I edit data in the table's child table.
If I edit the same data from a different tab, then go back to this table, the string will not update until I relaunch the app.
I have this code as well:
- (void)viewWillAppear:(BOOL)animated
{
[self refreshFetchedResultsController];
[self.logTableView reloadData];
}
Edit:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"Cell";
TDBadgedCell *cell = [[[TDBadgedCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
- (void)configureCell:(TDBadgedCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
cell.textLabel.textColor = [UIColor blackColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.textLabel.text = [logArray objectAtIndex:indexPath.row];
cell.backgroundColor = [UIColor clearColor];
cell.imageView.image = [UIImage imageNamed:#"17-bar-chart.png"];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:#"MMM d, y"];
NSDate *date = nil;
NSDate *today = [NSDate date];
NSDate *thisWeek = [today dateByAddingTimeInterval: -604800.0];
NSDate *thisMonth = [today dateByAddingTimeInterval: -2629743.83];
if (indexPath.row == 0)
{
date = [NSDate date];
NSString *dateString = [dateFormatter stringFromDate:date];
cell.badgeString = dateString;
}
else if (indexPath.row == 1)
{
if ([[self.fetchedResultsController fetchedObjects]count] > 1)
{
self.session = [[self.fetchedResultsController fetchedObjects]objectAtIndex:1];
NSDate *date = self.session.timeStamp;
NSString *dateString = [dateFormatter stringFromDate:date];
cell.badgeString = dateString;
}
else
{
cell.badgeString = #"None";
}
}
else if (indexPath.row == 2)
{
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setPredicate: [NSPredicate predicateWithFormat:#"(timeStamp >= %#) AND (timeStamp <= %#)", thisWeek, today]];
[fetchRequest setEntity:[NSEntityDescription entityForName:#"Session" inManagedObjectContext:managedObjectContext]];
NSError *error = nil;
NSArray *results = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
NSLog(#"Fetch error: %#", error);
cell.badgeString = [NSString stringWithFormat:#"%i", [results count]];
[fetchRequest release];
}
else if (indexPath.row == 3)
{
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
[fetchRequest setPredicate:[NSPredicate predicateWithFormat:#"(timeStamp >= %#) AND (timeStamp <= %#)", thisMonth, today]];
[fetchRequest setEntity:[NSEntityDescription entityForName:#"Session" inManagedObjectContext:managedObjectContext]];
NSError *error = nil;
NSArray *results = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
NSLog(#"Fetch error: %#", error);
cell.badgeString = [NSString stringWithFormat:#"%i", [results count]];
[fetchRequest release];
}
else if (indexPath.row == 4)
{
cell.badgeString = [NSString stringWithFormat:#"%i", [[self.fetchedResultsController fetchedObjects] count]];
NSLog(#"%i", [[self.fetchedResultsController fetchedObjects] count]);
}
UIImageView *myImageView = nil;
if (indexPath.row == 0 || indexPath.row == 1)
{
int myInt = cell.badgeString.length;
if (myInt > 11)
{
myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"silvercell7.png"]];
}
else if (myInt < 5)
{
myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"silvercell9.png"]];
}
else
{
myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"silvercell8.png"]];
}
}
else
{
myImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"silvercell5.png"]];
}
[cell setBackgroundView:myImageView];
[myImageView release];
cell.badgeColor = [UIColor colorWithRed:24/255.0 green:83/255.0 blue:170/255.0 alpha:1.0];
[cell.badge setNeedsDisplay];
[dateFormatter release];
}
I think, you might be able to see the image for the newly added row. But not text Because you don't have support for that in your code.
In you code, you are always creating the new cell, Try with reusing the cell with below code.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSMutableString *CellIdentifier = [[NSMutableString alloc] initWithCapacity:10]
[CellIdentifier appendFormat:#"Cell_%d_%d",indexPath.section,indexPath.row];
TDBadgedCell *cell = (TDBadgedCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
TDBadgedCell *cell = [[[TDBadgedCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
}
[self configureCell:cell atIndexPath:indexPath];
return cell;
}