iPhone Coding: Problem with UITableView selection

I have a strange problem with my UITableView. I want all the cells in the table to be selectable, such that if a cell is selected, an appropriate action is executed. All the cells in my table are currently selectable apart from the cell at row 0 (the cell at that appears at the top of the table). This cell is not selectable, even though it has been set to allow for selection. Any ideas?


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
tableView.allowsSelection = YES;
static NSString *SettingsTableID = @"SettingsTableID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:SettingsTableID]; 
if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
                                   reuseIdentifier: SettingsTableID] autorelease];
}
cell.textLabel.text = [tableHeadingsArray objectAtIndex:row];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 
return cell;

}


Many thanks.

Answers


Sorry everyone, I'm being stupid. :) This code was in my ViewController sub-class. I copied the class from an example, and forgot to check it over thoroughly before using it.

-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath{
NSUInteger row = [indexPath row];
if (row == 0)
    return nil;
return indexPath; 

}

Deleting this has fixed the problem.

Cheers.


Need Your Help

Java: Getting photo click effect after screenshot

java swing screenshot

I have written two classes, FullScreen, which contains the logic for the screenshot, and FullScreenGUI, which contains the logic for simulating the photo click effect.

Is there a way to refactoring this match case function?

scala pattern-matching

I have this code that will repeat multiple times (more than 15 times) across my app.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.