help in selecting a row in a tableview and pushing that row into anotherview? sturgling on this sinc
Posted
by Madhu
on Stack Overflow
See other posts from Stack Overflow
or by Madhu
Published on 2010-05-07T17:46:18Z
Indexed on
2010/05/08
15:38 UTC
Read the original article
Hit count: 214
iphone
|iphone-sdk
Hi,
I have a list of about 5 items in a tableview which I bought them from a database and now when i am trying to push each of them into different views in DidSelectRow() what I am seeing is it is showing me all the views in all the categories.... here is the code I have written....
Here is the code written in cell for row at indexpath:
- (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];
}
BeautyQuotes *bQuote = (BeautyQuotes*)[mBeautyQ objectAtIndex:indexPath.row];
cell.textLabel.text = bQuote.qBeauty;
[cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator] ;
return cell;
and in didselectrow() i have written this code:
id count1 = [mBeautyQ count];
while (count1--) {
object = [mBeautyQ objectAtIndex:count1];
}
[mBeautyQ release];
if([[object objectAtIndex:indexPath.row] isEqual : @"Beauty Quotes"]){
[tableView deselectRowAtIndexPath:indexPath animated:NO];
BeautysubViewController *subBeauty = [[BeautysubViewController alloc] initWithNibName:@"BeautysubViewController" bundle:nil];
//subBeauty.selected =[regions objectAtIndex:indexPath.row];(this is not working)
[subBeauty setTitle:@"Beauty Quotes"];
NSLog(@"it is about push beauty subview controller");
[self.navigationController pushViewController:subBeauty animated:YES];
[subBeauty release];
}
in this way i am pusing all the rows in to different views....but when I am pushing this into beautyquotes it is showing me all other views along with this....
struggling on this a lot please help me in dealing with this....
© Stack Overflow or respective owner