I`m trying to implement the style of the Label-Image-Label etc.. in UItableviewCell, each row might have 3 or 4 or 5 labels with image between them. The text for the labels are stored in plist as array/dictionary ,keys are airprort1 airport2 etc.
I`m stuck at setting the cells and labels and image programmatically.
Tried with storyboard yet couldn`t figure the logic.
Here is my code so far:
#import "ShowLabelTVC.h"
#interface ShowLabelTVC ()
#end
#implementation ShowLabelTVC
#synthesize flights;
- (void)viewDidLoad {
[super viewDidLoad];
NSString *myListPath = [[NSBundle mainBundle] pathForResource:#"flight" ofType:#"plist"];
flights = [[NSMutableArray alloc]initWithContentsOfFile:myListPath];
NSLog(#"%#", flights);
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return flights.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = #"TagCell";
TagCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[TagCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
// Configure the cell...
//for (int i = 0; i < flights.count; i++)
//{
// cell.sec1Label.text = [[flights objectAtIndex:indexPath.row] valueForKey:#"airport1"];
// if(i != flights.count - 1)
// {
// }
//}
return cell;
}
#end
Cameron what i want to acomplish is to have each cell show the correct amount of labels seperated by an image.
For example:
CELL1:
Airport1 Image Airport2 Image Airport3 >
CELL2:
Airport1 Image Airport2 Image Airport 3 Image Airport4 >
Etc.
The data come from a plist array with dictionary as follow
Root:
Flight1
Airport1:"kwi"
Airport2:"cai"
Airport3:"kwi"
Flight2
Airport1:"kwi"
Airport2:"bkk"
Airport3:"mnl"
Airport4:"bkk"
Airport5:"kwi"
Flight3
Airport1:"kwi"
Airport2:"jed"
Airport3:"kwi
So i need to make uilabels programatically with an uiimage inbetween each label horizontally!!
And here were i'm stuck..
I don't have much reputation to attach an image of the final result i want to accomplish..
Related
I'm creating a UITableViewController to list names of people and a star next to their name to indicating favorite people like so
The stars light up when touched, indicting a favorite, the row number of that cell goes into an NSMutableArray which is called in this method.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
When I tap a cell and add the index to the array, everything works, until I scroll down, and more stars are filled. They are in random, I believe, a few popup every time I scroll up then down, and look like this, faded stars...
This is the full star
Somehow the stars that shouldn't be filled are faded.
I cannot pin point where the stars are getting switched to on. The log only shows setting the star to on when I scroll to the particular cell.
My problem is that stars are switched on when they should not be, my array is good, I've checked that multiple times, it has to be the UITableView.
This is my code,
I only have two images of that star, one filled and one empty, and the
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
CustomCell *cell = [tableView cellForRowAtIndexPath:indexPath];
// NSLog(#"%i",[[cell.contentView subviews] count]);
// NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[cell.contentView subviews]];
[tableView reloadData];
UIImageView *star = cell.star;
NSLog(#"Star Tag: %i",star.tag);
if (star.tag == kStarEmpty) {
[[Global sharedGlobal].favTeachers addObject:[NSString stringWithFormat:#"%i",cell.identifierTag]];
NSLog(#"Added: %i",cell.identifierTag);
// NSLog(#"setting star image: 1");
[star setImage:[UIImage imageNamed:#"star.png"]];
[star setTag:kStarFilled];
} else if (star.tag == kStarFilled) {
[[Global sharedGlobal].favTeachers removeObject:[NSString stringWithFormat:#"%i",cell.identifierTag]];
NSLog(#"Removed: %i",cell.identifierTag);
// NSLog(#"setting star image: 2");
[star setImage:[UIImage imageNamed:#"star_empty.png"]];
[star setTag:kStarEmpty];
}
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *teacher = [[Global sharedGlobal].teachers objectAtIndex:indexPath.row];
static NSString *CellIdentifier = #"Cell";
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:#"Cell"];
if (cell == nil) {
cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
UIImageView *starView = [[UIImageView alloc] init];
starView.image = [UIImage imageNamed:#"star_empty.png"];
starView.frame = CGRectMake(720, 2, 29, 29); //748,22
[starView setTag:kStarEmpty];
cell.star = starView;
[cell addSubview:starView];
cell.identifierTag = indexPath.row;
NSLog(#"This cell's identifier tag: %i",cell.identifierTag);
cell.textLabel.text = [[Global sharedGlobal].teachers objectAtIndex:indexPath.row];
for (int i = 0; i < [[Global sharedGlobal].favTeachers count]; i++) {
int favTeacherTag = [[[Global sharedGlobal].favTeachers objectAtIndex:i] intValue];
NSLog(#"%i",i);
NSLog(#"Fav Teacher Tag: %i",favTeacherTag);
if (cell.identifierTag == favTeacherTag) {
NSLog(#"found fav teacher: %i",cell.identifierTag);
NSLog(#"------------------------------------------");
// NSMutableArray *array = [[NSMutableArray alloc] initWithArray:[cell.contentView subviews]];
NSLog(#"setting star image");
[starView setImage:[UIImage imageNamed:#"star.png"]];
NSLog(#"Previous star tag: %i",starView.tag);
[starView setTag:kStarFilled];
break;
}
NSLog(#"--------------------------------");
}
return cell;
}
EXTRA INFO:
I have a custom class for the cells, which adds the cell.identifierTag as an int.
I am using Storyboard
I use static cells in Storyboard
Thank you! If you need any more information please comment and ask.
You need to make sure to set the UIImage to nil in the else block here:
if (cell.identifierTag == favTeacherTag) {
//your existing code
} else {
[starView setImage:nil];
};
This is because the cells are reused, and you may be getting a cell that had previously had the star image added.
call [tableView reloadData] at end of (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath method
After two days of this I finally figured it out. :D
I added this code, because I was using the same UIImageView sometimes and kept adding image views every time this - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath was called.
UIImageView *starView = [[UIImageView alloc] init];
if (cell.star == nil) {
starView.image = [UIImage imageNamed:#"star_empty.png"];
starView.frame = CGRectMake(720, 2, 29, 29); //748,22
[starView setTag:kStarEmpty];
cell.star = starView;
[cell addSubview:starView];
} else if (cell.star != nil) {
starView = cell.star;
}
I have searched for a more fitting answer to NSInternalInconsistencyException I receive in the following sample app I wrote, but still nothing. The goal is to create an expand/collapse functionality for the top row in each section of the tableView. Right now I try to implement the expand part, and this works for row 0 in section 0. As soon as the user taps row 0 in another section this error appears:
** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to resolve row for index path: 2 indexes [0, 1]'
This is strange since I store each and every UITableViewCell for the table in a mutable array of arrays. NSMutableArray *cellForRow, where each index represents a section in the table and each object is an object of type NSMutableArray. I do this to avoid any issues arising from queueing reusable cells that I first thought triggered the above exception.
The exception happens at the insertRowsAtIndexPaths statement. I read earlier here that the UITableViewController code must keep track of changes to the number of rows caused by insertions/deletion. I believe I do that with NSMutableArray *rowsInSection so that the UITableView data source method:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
returns the correct number of rows in a section after a change.
What am I doing wrong in my code to get the above mentioned exception?
This is the interface file:
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#interface MasterViewController : UITableViewController {
NSMutableArray *rowsInSection;
NSMutableArray *cellForRow;
}
#property (nonatomic,strong) NSMutableArray *rowsInSection;
#property (nonatomic,strong) NSMutableArray *cellForRow;
#end
And this is the implementation file:
#import "MasterViewController.h"
const NSInteger numSections = 4;
const NSInteger numRows = 1 + 4;
const NSInteger addRemoveRows = 4;
#implementation MasterViewController
#synthesize rowsInSection;
#synthesize cellForRow;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = #"Table View";
rowsInSection = [NSMutableArray arrayWithCapacity:numSections];
cellForRow = [NSMutableArray arrayWithCapacity:numSections];
}
return self;
}
#pragma mark - View lifecycle
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.tableView.backgroundColor = [UIColor clearColor];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.dataSource = self;
self.tableView.delegate = self;
// add number of rows for section
for (NSInteger i = 0; i < numSections; i++) {
[self.rowsInSection addObject:[NSNumber numberWithInteger:1]];
}
// container for reusable table view cells
for (NSInteger i = 0; i < numSections; i++) {
NSMutableArray *rowsArray = [NSMutableArray arrayWithCapacity:numRows];
for (NSInteger j = 0; j < numRows; j++) {
// top row in section
if (j == 0) {
UITableViewCell *topCell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
topCell.accessoryType = UITableViewCellAccessoryNone;
topCell.contentView.backgroundColor = [UIColor whiteColor];
topCell.textLabel.textColor = [UIColor blueColor];
[rowsArray addObject:topCell];
// the rest
} else {
UITableViewCell *simpleCell = [[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil];
simpleCell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
simpleCell.textLabel.textColor = [UIColor whiteColor];
[rowsArray addObject:simpleCell];
}
}
// add rows for current section into cell container
[self.cellForRow addObject:rowsArray];
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
// Customize the number of sections in the table view.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return numSections;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSInteger rows = [(NSNumber *)[self.rowsInSection objectAtIndex:section] integerValue];
//NSLog(#"%#",self.rowsInSection);
//NSLog(#"Rows: %d in section: %d",rows,section);
return rows;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
// Configure the cell.
// row count
NSLog(#"Rows: %d in section: %d",[tableView numberOfRowsInSection:indexPath.section],indexPath.section);
if (indexPath.row == 0) {
UITableViewCell *cell = (UITableViewCell *)[[self.cellForRow objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
cell.textLabel.text = #"TOP ROW";
NSLog(#"Row: %d in section: %d - %#",indexPath.row,indexPath.section,cell);
return cell;
} else {
UITableViewCell *cell = (UITableViewCell *)[[self.cellForRow objectAtIndex:indexPath.section] objectAtIndex:indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:#"row: %d",indexPath.row];
NSLog(#"Row: %d in section: %d - %#",indexPath.row,indexPath.section,cell);
return cell;
}
// not reaching here
return nil;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return [NSString stringWithFormat:#"Section %d",section];
}
#pragma mark - Row editing
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// add table view cells to section if tapped on top row
if (indexPath.row == 0 && [tableView numberOfRowsInSection:indexPath.section] == 1) {
//NSLog(#"Selected row: %d in section: %d",indexPath.row,indexPath.section);
NSMutableArray *indexPathArray = [NSMutableArray array];
for (NSInteger i = 1; i <= addRemoveRows; i++) {
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:i inSection:indexPath.section];
[indexPathArray addObject:indexPath];
}
// update row count for section
NSInteger newRowCount = addRemoveRows + 1; // +1 for existing top row
[self.rowsInSection replaceObjectAtIndex:indexPath.section withObject:[NSNumber numberWithInteger:newRowCount]];
[tableView beginUpdates];
[tableView insertRowsAtIndexPaths:indexPathArray withRowAnimation:UITableViewRowAnimationTop];
[tableView endUpdates];
}
}
#end
If you are inserting/deleting multiple rows at the same time it has to be bracketed with calls to beginUpdates/endUpdates.
The table view data source needs to be consistent with your insert/delete calls.
Set a break point in numberOfRowsInSection to assure that the number of rows in a section is correct after the insert/delete rows.
(i'm not going to read through all your code to debug it for you.)
good luck!
I was having this issue as well.
It wasn't something I was doing wrong inside the body of code, but I didn't realize an object was being inserted into my dataSource at another time. If you're getting this issue, make sure you follow bshirley's advice and stick a breakpoint on numberOfRowsInSection AND the body of code where you add the item. Make sure the number is the same amount of items in your dataSource throughout the lifecycle of adding the data. There really isn't any reason it should fail.
It is fairly simple, just make sure you're keeping your data and indexpath amounts before and after the update. Otherwise this exception will be thrown.
You are not only inserting cells, you also deleting old row, but the table view does not know about it as you haven't told it. So the table view "knows" it has one row, then you tell it you've added lets say two rows. The table view knows, that it should contain 3 rows BUT it founds only two as you've deleted the old one... What you need is or to use -(void)tableView:(UITableView)tableView deleteRowsAtIndexPaths:(NSArray)indexPath withRowAnimation:(UITableViewRowAnimation)animation; or delete one index path from array of added rows...And by the way, return to use reusable cells as it have no connection with the error you've faced...
In this method
-(void)tableView:(UITableView)tableView deleteRowsAtIndexPaths:(NSArray)indexPath withRowAnimation:(UITableViewRowAnimation)animation;
your variable NSIndexPath *indexPath is repetition with the variable of this method
My goal is to have something like a "select" option in a HTML form, but now in my app. After doing research it's probably best to do this with a table view. I though of the picker view, but the fixed height is too big.
With the interface builder I simply placed a table view on my subclass of UIViewController.
How do I fill the Table view with options? I've seen many tutorials, but those are all for having a UITableView as their own class and filling up the entire screen. In my application this is just a small piece of the entire form.
What a nightmare to create a relatively simple thing like a table view. It either crashes or I get a table view that covers my entire view and that is not filled with anything.
The variable countryTable is connected to the object in the interface builder.
Frustrated after a hard day of work. Anyone got the complete working code? That would be great. I already had a great look at apple's explenation AND various tutorials, but I can't figure it out.
I've tried multiple things, but this is my current code:
#interface myView: UIViewController
{
NSArray *countryArray;
IBOutlet UITableView * countryTable;
}
#property (nonatomic, retain) UITableView *countryTabel;
#end
and in my .m file
#implementation myView
#synthesize countryTable;
- (void)loadView
{
self.countryTable.dataSource = self;
}
- (void)viewDidLoad
{
NSArray *array = [[NSArray alloc] initWithObjects:#"test1", #"test2",
#"test3",nil];
self.countryTable = array;
[array release];
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void) dealloc
{
[countryTable release];
[super dealloc];
}
#pragma mark -
#pragma mark Table View Data Source Methods
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section
{
return [self.countryTable count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *SimpleTableIdentifier = #"SimpleTableIdentifier";
UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:SimpleTableIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [countryTable objectAtIndex:row];
return cell;
}
#end
You are on the right track. If you were to use a UITableViewController subclass, you would obviously have a full screen table view by default. Going the route of using a UIViewController subclass with a UITableView as a subview in the UIViewController's view is the right way to go. A few things that you will need to address are:
1) In the UIViewControllers header file you will need to add <UITableViewDatasource, UITableViewDelegate> as your view controller is responsible for fill implementing this functionally.
2) In viewDidLoad:, set self.contryTable.delegate = self; and self.countryTable.datasource = self;
The following protocol methods need to be implemented like so:
- (NSInteger)tableView:(UITableView *)tableView
numberOfRowsInSection:(NSInteger)section {
return countryArray.count;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *SimpleTableIdentifier = #"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SimpleTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:SimpleTableIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
cell.textLabel.text = [countryArray objectAtIndex:row];
return cell;
}
Hope this helps.
Im trying to implement 3 different table views that load 3 different arrays of information,
In some forum I read that I could use the .tag to differentiate the tables and use conditionals to load the data,
I tried
changing the name of the table
in identity /name of the xib to my table,
and use
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
//---try to get a reusable cell---
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//---create new cell if no reusable cell is available---
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
/*
//---set the text to display for the cell---
NSString *cellValue = [listOfMovies objectAtIndex:indexPath.row];
cell.textLabel.text = cellValue; */
if (tableView.tag == 1) {
//Deal with table 1 - contains 5 sections
cell.textLabel.text = [array objectAtIndex:indexPath.row];
} else if (tableView.tag == 2) {
//Deal with table 2 - contains 1 section
cell.textLabel.text = [array2 objectAtIndex:indexPath.row];
}
// cell.textLabel.text = [array3 objectAtIndex:indexPath.row];
else {
cell.textLabel.text = [array objectAtIndex:indexPath.row];
}
return cell;
}
to change the cell content to show the other array
but is not working (long shot!)
so, How to define this .tag for my tables
also, I want the same for row (count) and sections 1
for all the tables,
so shall I just leave them like that??
I have the 3 tables showing the same array at the moment,
thank you so much!
Um, haven't tried this, but I'd be inclined to look into associating each table view with it's own unique UITableViewDataSource instance. That way they do not have to be all coded in the same class and everything becomes simpler. Not sure how you would go about assembling this, but it should be too hard to work out I would think.
I think you're over-complicating things. In one of my apps I have one table view controller for three tables. The interface definition is something like:
#interface TableViewController : UITableViewController <UIGestureRecognizerDelegate> {
IBOutlet UITableView *leftTable;
IBOutlet UITableView *centerTable;
IBOutlet UITableView *rightTable;
...
Then, in each of the delegate methods, I check to see which table it is before performing the relevant action or returning the relevant result. For example:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (tableView == leftTable) {
return [self.leftItems count];
} else if (tableView == centerTable) {
return [self.centerItems count];
} else {
return [self.rightItems count];
}
}
I am making an application with a UITableView that has a few sections (2), and when I run, the table view has this annoying gray index bar on the side, like the one in the "iPod" application, that has but 2 options in it. My question is, how do I hide the "index bar," because it is an unnecessary waste of space?
Example:
Code snippets:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return [sections count];
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
return sections;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0) {
return 2;
}
return 1;
}
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
return [sections objectAtIndex:section];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = #"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
// Configure the cell.
cell.textLabel.text = [content objectAtIndex:(indexPath.row + [[sectionAmounts objectAtIndex:indexPath.section] intValue])];
tableView.showsVerticalScrollIndicator = NO;
return cell;
}
- (void)viewDidLoad {
[super viewDidLoad];
content = [NSArray arrayWithObjects:#"Sphere", #"Cylinder", #"Circle", nil];
sections = [NSArray arrayWithObjects:#"3d", #"2d", nil];
sectionAmounts = [NSArray arrayWithObjects:[NSNumber numberWithInt:0], [NSNumber numberWithInt:2], nil]; //Second number is objects in first section... odd huh?
self.tableView.showsVerticalScrollIndicator = NO;
[content retain];
[sections retain];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
(Mind my odd comments...)
HiGuy
I tried this, and it didn't work for me.
so i went through the table view properties, and got this.
self.tableView.showsVerticalScrollIndicator = NO;
works like a charm.
*for any one who wants to do this in the future.
That "scroll bar" is your index bar, assuming you're talking about the giant grey thing.
Return nil from sectionIndexTitlesForTableView: and it'll go away.
I had similar issue, however had to deal with my header/footer. Essentially I just removed the following methods
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
return #" "; //#"Top";
}
- (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section
{
return #" "; //#"Bottom";
}
You just use the below code and gray bar will go....
tableViewBrowse.sectionIndexTrackingBackgroundColor = [UIColor clearColor];
Use sectionIndexBackgroundColor property of UITableView to set the color of index bar to clear color as hiding scroll bar is going to hide the indexes as well.
Add it to your viewDidLoad: as following:
- (void)viewDidLoad {
[super viewDidLoad];
self.tableView.sectionIndexBackgroundColor = [UIColor clearColor]; //Replace it with your desired color
}