Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

yaboy10holla

macrumors newbie
Original poster
Feb 19, 2011
17
0
Please Help!

I'm trying to program a row in UITableview (added as a subview of another object) to show/hide other objects when tapped. this is how i tried to do it

Code:
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	if ([groupList didSelectRowAtIndexPath:0]) {
		crowdInfoTwo.hidden=NO;
}
This is unsuccessful. I'd realllly appreciate a push in the right direction.

thanks
 
Last edited by a moderator:
Can you give a bit mode detail what you are trying to achieve here? And what the variables actually are? Second, I'd add some NSLoging to see what is called when I tap a row:

Code:
- (void)tableViewUITableView *)tableView didSelectRowAtIndexPathNSIndexPath *)indexPath {
   NSLog(@"Row %i in section %i has been tapped", indexPath.row, indexPath.section);
   if ([groupList didSelectRowAtIndexPath:0]) {
      NSLog(@"If statement true");
      crowdInfoTwo.hidden=NO;
   }

What is groupList & crowdInfo? What does didSelectRowAtIndexPath return?
 
sure sorry. groupList is the name of the UITableView, and crowdInfoTwo is a UIScrollView I want to show and hide.

i'm just having trouble getting the rows of the table to "do" something when I tap them, in this case, showing a UIScrollView
 
Code:
- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	[B]if (indexPath.row == 0) [/B]{
		crowdInfoTwo.hidden=NO;
               }
}

Note that indexPath has a .row and a .section. That will be of interest if your tableview has more than one section.

- Olaf
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.