How to disable the click option or selecting the row in a table in iphone?
I am new to iphone development.I am displaying a xml parsed contents in a grouped tableView.I want disable the click event on it(i should not be able to click it at all) .Since it is grouped table , it contains two tables and i want to disable the first table only and not the second table.How can i achieve it?Please help开发者_如何学JAVA me out.Thanks.
If you don't want the user to be able to click on a table view, just use this code:
- (NSIndexPath *)tableView:(UITableView *)tableView
willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
return nil;
}
Use Uitable View delegates and data Sources
//#endif
#pragma mark - UITableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
NSLog(@"Returning num sections");
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"Returning num rows");
return [copyListOfItems count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
}
- (NSIndexPath *)tableView:(UITableView *)tableView
willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
return nil;
}
精彩评论