Potential leak of an object, Build and Analyze, viewForHeaderInSection - iphone

I've just mad Build and Analyze with my project on iphone, and i got warning from analyzer which i don't understand, this is my function:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
NSLog(#"user did select row at index: %d.%d", [indexPath section], [indexPath row]);
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
NSLog(#">>> Entering %s <<<", __PRETTY_FUNCTION__);
//UIView *customView;
if(section ==6){
UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 300.0, 36.0)];
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.shadowColor = [UIColor blackColor];
headerLabel.shadowOffset = CGSizeMake(0, 1);
headerLabel.font = [UIFont boldSystemFontOfSize:13];
headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 30.0);
headerLabel.text = #"Personal Data";
[customView addSubview:headerLabel];
return customView;
}
if(section ==10){
UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 300.0, 36.0)];
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.shadowColor = [UIColor blackColor];
headerLabel.shadowOffset = CGSizeMake(0, 1);
headerLabel.font = [UIFont boldSystemFontOfSize:13];
headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 30.0);
headerLabel.text = #"Actions";
[customView addSubview:headerLabel];
[headerLabel release];
return customView;
}
else {
return nil;
}
NSLog(#"<<< Leaving %s >>>", __PRETTY_FUNCTION__);
}
and in the lines with return customView, the analyzer says:
"potential leak of an object allocated in line ###", can somebody explain me why it's hapenning?

You need:
return [customView autorelease];
You allocate your customView and don't release it anywhere in your code. Once you pass it to table view it will get retained so you can safely dispose of its ownership - by sending autorelease message.
P.S. you also forgot to release headerLabel in section == 6 branch

Related

iOS- mimic system default tableView header

I want to mimic programatically the exact look of this header:
So far, my best try was:
UILabel* header = [[UILabel alloc] init] ;
header.backgroundColor = [UIColor clearColor];
header.textAlignment = NSTextAlignmentCenter;
header.textColor = [[UIColor alloc] initWithRed:86 green:92 blue:112 alpha:0.1];
header.shadowColor = [UIColor darkGrayColor];
header.shadowOffset = CGSizeMake(1,0);
header.font = [UIFont boldSystemFontOfSize:18];
But it's looks like this:
Can someone please help me with the exact way to do that?
Thanks in advance!
A Norvegian guy has written a blog post about this a while ago: http://www.gersh.no/posts/view/default_styling_of_sections_headers_in_uitableview_grouped
All credits go to him for the code.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 40)];
containerView.backgroundColor = [UIColor groupTableViewBackgroundColor];
CGRect labelFrame = CGRectMake(20, 2, 320, 30);
if(section == 0) {
labelFrame.origin.y = 13;
}
UILabel *label = [[UILabel alloc] initWithFrame:labelFrame];
label.backgroundColor = [UIColor clearColor];
label.font = [UIFont boldSystemFontOfSize:17];
label.shadowColor = [UIColor colorWithWhite:1.0 alpha:1];
label.shadowOffset = CGSizeMake(0, 1);
label.textColor = [UIColor colorWithRed:0.265 green:0.294 blue:0.367 alpha:1.000];
label.text = [self tableView:tableView titleForHeaderInSection:section];
[containerView addSubview:label];
return containerView;
}
EITHER
You need to set header.frame = CGRectMake(10,1, 100, 18 );
OR
Use Datasource method of UITableView
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return #"Header"; // just pass name of your hearder
}
EDITED:
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50, 2, 100, 18)];
label.text= [self.listOfHeader objectAtIndex:section];
label.backgroundColor=[UIColor clearColor];
label.textAlignment=NSTextAlignmentLeft;
[view addSubview:label];
return view;
}
And also add
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 20;
}
What you can do it calculate the width of your UILabel dynamically/programmatically. Using this code :
CGSize maximumLabelSize = CGSizeMake(296,9999);
CGSize expectedLabelSize = [yourString sizeWithFont:yourLabel.font
constrainedToSize:maximumLabelSize
lineBreakMode:yourLabel.lineBreakMode];
Then add 10 pixle to the width you get. Set the frame of your UILabel. And, set it following way :
header.frame = CGRectMake(0.0,5.0,expectedLabelSize.width + 10.0,expectedLabelSize.height);
header.textAlignment = NSTextAlignmentRight;

Remove header space between 2 section in the UITableView

I use this code to set the color, etc for the Table View Section Header
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// create the parent view that will hold header Label
UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 300.0, 44.0)];
// create the button object
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:18];
headerLabel.shadowColor = [UIColor blackColor];
headerLabel.shadowOffset = CGSizeMake(0, 1.0);
headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 44.0);
if (section == 0) {
headerLabel.text = #"Section 0 header";
[customView addSubview:headerLabel];
}
if (section == 1) {
//headerLabel.text = #"Section 1 header";
//[customView addSubview:headerLabel];
customView = nil;
tableView.tableHeaderView = nil;
}
if (section == 2) {
headerLabel.text = #"Section 2 header";
[customView addSubview:headerLabel];
}
return customView;
}
In the section 1 I don't want a header, but there is still a bigger space between section 0 and section 1.
Implement tableView:heightForHeaderInSection:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html

Custom grouped UITable header in different sections

I have a question on multiple sections headers at different sections.
I have the following codes for the first section header text. however, in the second section, it displays the same header text as the first section. May I know how to modify the code so that i can display other text in the second header?
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
// create the parent view that will hold header Label
UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 300.0, 44.0)];
// create the button object
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:20];
headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 44.0);
// If you want to align the header text as centered
// headerLabel.frame = CGRectMake(150.0, 0.0, 300.0, 44.0);
headerLabel.text = #"section 1"; // i.e. array element
[customView addSubview:headerLabel];
return customView;
}
you have to use different customView for each section.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *customView = [[UIView alloc] initWithFrame:CGRectMake(10.0, 0.0, 300.0, 44.0)];
UILabel * headerLabel = [[UILabel alloc] initWithFrame:CGRectZero];
headerLabel.backgroundColor = [UIColor clearColor];
headerLabel.opaque = NO;
headerLabel.textColor = [UIColor whiteColor];
headerLabel.highlightedTextColor = [UIColor whiteColor];
headerLabel.font = [UIFont boldSystemFontOfSize:20];
headerLabel.frame = CGRectMake(10.0, 0.0, 300.0, 44.0);
// If you want to align the header text as centered
// headerLabel.frame = CGRectMake(150.0, 0.0, 300.0, 44.0);
if(section == 1)
headerLabel.text = #"section 1"; // i.e. array element
else if(section == 2)
headerLabel.text = #"section 2"; // i.e. array element
else
headerLabel.text = #"section 3";//and so on
[customView addSubview:headerLabel];
return customView;
}
Instead of this
headerLabel.text = #"section 1"; // i.e. array element
Use this
headerLabel.text=[arrayContainingSectionName objectAtIndex:section];

UIScrollView with paging not working ok

I have implement a scrollview with paging but it not work ok. For every view of the scrollview I must populate a tableview with certain values. Even if the values are correct received all the views are identical (the last view is the view on every subview of scrollview) Where is my mistake?
Here is my code :
- (void)viewDidLoad
{
[super viewDidLoad];
self.vehiculesenvisagesScrollView.pagingEnabled = YES;
self.vehiculesenvisagesScrollView.contentSize = CGSizeMake(vehiculesenvisagesScrollView.frame.size.width * [vehiculesEnvisages count], vehiculesenvisagesScrollView.frame.size.height);
self.vehiculesenvisagesScrollView.showsHorizontalScrollIndicator = NO;
self.vehiculesenvisagesScrollView.showsVerticalScrollIndicator = NO;
self.vehiculesenvisagesScrollView.scrollsToTop = NO;
vehiculesEnvisagesArray = [[NSMutableArray alloc] initWithObjects:#"Gamme", #"Usage",#"Délai d'echart",#"Type d'achart",#"Financement", nil];
for (int i=0; i<[vehiculesEnvisages count];i++){
[self loadScrollViewWithPage:i];
}
NSLog(#"views %#",[vehiculesenvisagesScrollView subviews]);
self.pageControlVehiculeEnvisages.numberOfPages=[vehiculesEnvisages count];
self.pageControlVehiculeEnvisages.currentPage=0;
}
- (void) loadScrollViewWithPage: (int) page {
NSLog(#"%d",page);
if (page < 0) return;
if (page >= [vehiculesEnvisages count]) return;
CGRect frame;
frame.origin.x = self.vehiculesenvisagesScrollView.frame.size.width * page;
frame.origin.y = 0;
frame.size = self.vehiculesenvisagesScrollView.frame.size;
UIView *oneview = [[UIView alloc] initWithFrame:frame];
tableViewVehiculesEnvisages=[[UITableView alloc] initWithFrame:CGRectMake(3, 0, 320, 233) style:UITableViewStyleGrouped];
tableViewVehiculesEnvisages.bounces=NO;
tableViewVehiculesEnvisages.backgroundColor=[UIColor clearColor];
[tableViewVehiculesEnvisages setDelegate:self];
[tableViewVehiculesEnvisages setDataSource:self];
self.gammeString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"gamme"];
self.usageString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"usage"];
self.delaiString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"delai"];
self.typeString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"achat"];
self.financementString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"financement"];
[oneview addSubview:tableViewVehiculesEnvisages];
NSLog(#"gamme%#", self.gammeString);
[self.vehiculesenvisagesScrollView addSubview:oneview];
[oneview release];
}
where gammeString,usageString,delaiString,typeString,financementString contains the text that will be set to some labels on a cell of tableview.
Here is my cellForRowAtIndexPath method :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"CellRecherchePartenaires"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:#"CellRecherchePartenaires"] autorelease];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.backgroundView.opaque = NO;
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.textLabel.opaque = NO;
cell.textLabel.textColor = [UIColor whiteColor];
cell.textLabel.highlightedTextColor = [UIColor whiteColor];
cell.textLabel.font = [UIFont boldSystemFontOfSize:15];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.opaque = NO;
cell.detailTextLabel.textColor = [UIColor whiteColor];
cell.detailTextLabel.highlightedTextColor = [UIColor whiteColor];
cell.detailTextLabel.font = [UIFont systemFontOfSize:15];
if (indexPath.row==0)
{
gammeLabel = [[UILabel alloc] init];
gammeLabel.frame = CGRectMake(150, -4, 150, 50);
gammeLabel.textColor=[UIColor grayColor];
gammeLabel.backgroundColor=[UIColor clearColor];
gammeLabel.text = self.gammeString;
[cell.contentView addSubview: [gammeLabel autorelease]];
}
if(indexPath.row==1)
{
usageLabel = [[UILabel alloc] init];
usageLabel.frame = CGRectMake(150, -4, 150, 50);
usageLabel.textColor=[UIColor grayColor];
usageLabel.backgroundColor=[UIColor clearColor];
usageLabel.text = self.usageString;
[cell.contentView addSubview: [usageLabel autorelease]];
}
if(indexPath.row==2)
{
delaiLabel = [[UILabel alloc] init];
delaiLabel.frame = CGRectMake( 150, -4, 150, 50);
delaiLabel.textColor = [UIColor grayColor];
delaiLabel.backgroundColor = [UIColor clearColor];
delaiLabel.text = self.delaiString;
[cell.contentView addSubview: [delaiLabel autorelease]];
}
if(indexPath.row==3)
{
typeLabel = [[UILabel alloc] init];
typeLabel.frame = CGRectMake( 150, -4, 150, 50);
typeLabel.textColor = [UIColor grayColor];
typeLabel.backgroundColor = [UIColor clearColor];
typeLabel.text =self.typeString;
[cell.contentView addSubview: [typeLabel autorelease]];
}
if(indexPath.row==4)
{
financementLabel = [[UILabel alloc] init];
financementLabel.frame = CGRectMake( 150, -4, 150, 50);
financementLabel.textColor = [UIColor grayColor];
financementLabel.backgroundColor = [UIColor clearColor];
financementLabel.text = self.financementString;
[cell.contentView addSubview: [financementLabel autorelease]];
}
}
[[cell textLabel] setText: [vehiculesEnvisagesArray objectAtIndex:indexPath.row]] ;
return cell;
}
- (void) loadScrollViewWithPage: (int) page {
NSLog(#"%d",page);
if (page < 0) return;
if (page >= [vehiculesEnvisages count]) return;
CGRect frame;
frame.origin.x = self.vehiculesenvisagesScrollView.frame.size.width * page;
frame.origin.y = 0;
frame.size = self.vehiculesenvisagesScrollView.frame.size;
UIView *oneview = [[UIView alloc] initWithFrame:frame];
tableViewVehiculesEnvisages=[[UITableView alloc] initWithFrame:CGRectMake(3, 0, 320, 233) style:UITableViewStyleGrouped];
tableViewVehiculesEnvisages.tag=page;
tableViewVehiculesEnvisages.bounces=NO;
tableViewVehiculesEnvisages.backgroundColor=[UIColor clearColor];
[tableViewVehiculesEnvisages setDelegate:self];
[tableViewVehiculesEnvisages setDataSource:self];
[oneview addSubview:tableViewVehiculesEnvisages];
NSLog(#"gamme%#", self.gammeString);
[self.vehiculesenvisagesScrollView addSubview:oneview];
[oneview release];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"CellRecherchePartenaires"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:#"CellRecherchePartenaires"] autorelease];
}
[self setTextt:tableView.tag];
cell.backgroundColor = [UIColor clearColor];
cell.selectionStyle = UITableViewCellSelectionStyleGray;
cell.backgroundView.opaque = NO;
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.textLabel.opaque = NO;
cell.textLabel.textColor = [UIColor whiteColor];
cell.textLabel.highlightedTextColor = [UIColor whiteColor];
cell.textLabel.font = [UIFont boldSystemFontOfSize:15];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.opaque = NO;
cell.detailTextLabel.textColor = [UIColor whiteColor];
cell.detailTextLabel.highlightedTextColor = [UIColor whiteColor];
cell.detailTextLabel.font = [UIFont systemFontOfSize:15];
if (indexPath.row==0)
{
gammeLabel = [[UILabel alloc] init];
gammeLabel.frame = CGRectMake(150, -4, 150, 50);
gammeLabel.textColor=[UIColor grayColor];
gammeLabel.backgroundColor=[UIColor clearColor];
gammeLabel.text = self.gammeString;
[cell.contentView addSubview: [gammeLabel autorelease]];
}
if(indexPath.row==1)
{
usageLabel = [[UILabel alloc] init];
usageLabel.frame = CGRectMake(150, -4, 150, 50);
usageLabel.textColor=[UIColor grayColor];
usageLabel.backgroundColor=[UIColor clearColor];
usageLabel.text = self.usageString;
[cell.contentView addSubview: [usageLabel autorelease]];
}
if(indexPath.row==2)
{
delaiLabel = [[UILabel alloc] init];
delaiLabel.frame = CGRectMake( 150, -4, 150, 50);
delaiLabel.textColor = [UIColor grayColor];
delaiLabel.backgroundColor = [UIColor clearColor];
delaiLabel.text = self.delaiString;
[cell.contentView addSubview: [delaiLabel autorelease]];
}
if(indexPath.row==3)
{
typeLabel = [[UILabel alloc] init];
typeLabel.frame = CGRectMake( 150, -4, 150, 50);
typeLabel.textColor = [UIColor grayColor];
typeLabel.backgroundColor = [UIColor clearColor];
typeLabel.text =self.typeString;
[cell.contentView addSubview: [typeLabel autorelease]];
}
if(indexPath.row==4)
{
financementLabel = [[UILabel alloc] init];
financementLabel.frame = CGRectMake( 150, -4, 150, 50);
financementLabel.textColor = [UIColor grayColor];
financementLabel.backgroundColor = [UIColor clearColor];
financementLabel.text = self.financementString;
[cell.contentView addSubview: [financementLabel autorelease]];
}
[[cell textLabel] setText: [vehiculesEnvisagesArray objectAtIndex:indexPath.row]] ;
return cell;
}
-(void)setTextt:(int)page
{
self.gammeString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"gamme"];
self.usageString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"usage"];
self.delaiString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"delai"];
self.typeString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"achat"];
self.financementString=[[vehiculesEnvisages objectAtIndex:page]valueForKey:#"financement"];
}
Replace your code with this code,You defiantly get solution.
I found the solution of my issue : I use a NSMutableArray instead of a NSString and it works ok.

how to give different header section title for different sections

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
NSString *sectionTitle = [self tableView:tableView titleForHeaderInSection:section];
if (sectionTitle == nil) {
return nil;
}
UILabel *label = [[[UILabel alloc] init] autorelease];
label.frame = CGRectMake(20, 6, 300, 30);
label.backgroundColor = [UIColor clearColor];
label.textColor = [UIColor colorWithHue:(136.0/360.0) // Slightly bluish green
saturation:1.0
brightness:0.60
alpha:1.0];
label.shadowColor = [UIColor whiteColor];
label.shadowOffset = CGSizeMake(0.0, 1.0);
label.font = [UIFont boldSystemFontOfSize:16];
label.text = sectionTitle;
// Create header view and add label as a subview
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, SectionHeaderHeight)];
[view autorelease];
[view addSubview:label];
return view;
}
this is for one section if i have 9 section then how can i set title
You need to implement
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section;
delegate method for UITableView.
This might solve your problem:
-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIControl *containerView = [[[UIControl alloc] initWithFrame:CGRectMake(0, 0, 320, 20)] autorelease];
UILabel *headerLabel = [[[UILabel alloc] initWithFrame:CGRectMake(10, 0, 320, 20)] autorelease];
headerLabel.textColor = [UIColor colorWithRed:50.0/255.0 green:44.0/255.0 blue:37.0/255.0 alpha:1.0];
[headerLabel setFont:[UIFont boldSystemFontOfSize:11.0]];
//[headerLabel setFont:[UIFont boldSystemFontOfSize:13.0]];
headerLabel.backgroundColor = [UIColor clearColor];
if(section == 0)
headerLabel.text = [NSString stringWithFormat:#"First Section"];
if(section == 1)
headerLabel.text = [NSString stringWithFormat:#"Second Section"];
if(section == 2)
headerLabel.text = [NSString stringWithFormat:#"Third Section"];
headerLabel.textColor = [UIColor colorWithRed:78.0/255.0 green:70.0/255.0 blue:59.0/255.0 alpha:1.0];
//headerLabel.font = [UIFont boldSystemFontOfSize:13.0];
[containerView addSubview:headerLabel];
return containerView;
}
Try this!
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
UIView *v =[[[UIView alloc] init] autorelease];
v.backgroundColor = [UIColor clearColor];
UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(10, 7, tableView.bounds.size.width - 10, 18)] autorelease];
label.textColor = [UIColor whiteColor];
label.font = [UIFont boldSystemFontOfSize:15];
label.backgroundColor = [UIColor clearColor];
if (section == 1) {
label.text = #"Section 1";
[v addSubview:label];
}
else if (section == 2) {
label.text = #"Section 2";
[v addSubview:label];
}
else if (section == 3) {
label.text = #"Section 3";
[v addSubview:label];
}
return v;
}
You need to know the titles, just use an NSArray, make it global alloc and init it in viewDidLoad and release the array in dealloc.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
UIView *aView=[[[NSBundle mainBundle] loadNibNamed:#"tblHeader" owner:self options:nil]objectAtIndex:0];
[(UILabel*)[aView viewWithTag:1] setText:[[self.reports objectAtIndex:section] valueForKey:#"domain"]];
return aView;
return nil;
}
Here u can insert your custom cell also u can use the Section and get those section wise you can use switch case and easily access the section.