Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

UITableView inside a UITableViewCell

gbergamogbergamo Posts: 123Registered Users @ @
edited August 2011 in iPhone SDK Development
Hello everyone!

I have a big problem (I think!)

I begin a tabBar application. In appDelegate I put a button in the middle of the tabbar. Ok! this works fine!
When I touch this button, I open a modal view:
RefundViewController *controller = [[RefundViewController alloc] initWithNibName:@"RefundViewController" bundle:nil];	
[self.tabBarController presentModalViewController:controller animated:YES];
[controller release];

My problem... In this View I have a UITableView w/ self delegate, this Table has a CustomCell, this custom cell has another UITableView, but I have to add another file to delegate this TableView.
Everything works fine! but HOW CAN I GET THE TOUCH ON THE CELL ????
Yeah, I have the method
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
I have to send an information to the first View (refundViewController). How can I do that?


Thanks!
Post edited by gbergamo on
Vai de Que? - Car supplies Util - <a href="http://itunes.apple.com/br/app/vai-de-que/id433062495?mt=8" target="_blank">Download</a><br />
iJob - Job search (Br) - <a href="http://itunes.apple.com/br/app/ijob/id440970882?mt=8" target="_blank">Download</a>

Replies

  • Duncan CDuncan C Posts: 9,037Tutorial Authors, Registered Users @ @ @ @ @ @ @
    edited August 2011
    gbergamo wrote: »
    Hello everyone!

    I have a big problem (I think!)

    I begin a tabBar application. In appDelegate I put a button in the middle of the tabbar. Ok! this works fine!
    When I touch this button, I open a modal view:
    RefundViewController *controller = [[RefundViewController alloc] initWithNibName:@"RefundViewController" bundle:nil];	
    [self.tabBarController presentModalViewController:controller animated:YES];
    [controller release];
    

    My problem... In this View I have a UITableView w/ self delegate, this Table has a CustomCell, this custom cell has another UITableView, but I have to add another file to delegate this TableView.
    Everything works fine! but HOW CAN I GET THE TOUCH ON THE CELL ????
    Yeah, I have the method
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    
    I have to send an information to the first View (refundViewController). How can I do that?


    Thanks!

    A table view inside a single custom table view cell? That sounds pretty awful, both technically and as a user interface.

    I think you're on your own to get that working. It's likely to cause odd problems like not being able to resolve where a gesture belongs.
    Regards,
    Duncan C
    WareTo

    widehead.gif
    Animated GIF created with Face Dancer, available for free in the app store.

    I'm available for one-on-one help at CodeMentor
  • gbergamogbergamo Posts: 123Registered Users @ @
    edited August 2011
    Duncan C wrote: »
    A table view inside a single custom table view cell? That sounds pretty awful, both technically and as a user interface.

    I think you're on your own to get that working. It's likely to cause odd problems like not being able to resolve where a gesture belongs.

    Man, for the user interface, it's really cool! I do this: when the user enter in the view I have the table showing the "menu" items, so, when he/she touch on the menu item, this cell grow and show that other cell whit the options...

    You don't have any tip for me? an idea??

    Thanks to reply...
    Vai de Que? - Car supplies Util - <a href="http://itunes.apple.com/br/app/vai-de-que/id433062495?mt=8" target="_blank">Download</a><br />
    iJob - Job search (Br) - <a href="http://itunes.apple.com/br/app/ijob/id440970882?mt=8" target="_blank">Download</a>
  • mavrik5150mavrik5150 Posts: 194Registered Users
    edited August 2011
    You could probably assign a Tag value to each Table, so then you can differentiate between which table is being touched by using the Tag value as the first statement in your if block
    NSInteger tableTag = tableView.tag;
    
    if (tableTag == 20) {
    //Cell in Table one Selected so put action here
    }
    
    else if (tableTag == 30) { 
    //Second Table Cell selected put that action here
    }
    

    That's just my guess, that's how I handled different UIAlerts that could show up on a specific screen (one alert is for connectivity issues, another for updating some default values, and a third for getting more descriptions on a certain cell) but I don't know for sure it this would work for what you have.
  • rcirkarcirka Posts: 25Registered Users
    edited August 2011
    You will need to set the delegate of the inner uitableview, preferably to a different class as to not to mix up the delegate of the parant uitableview. As Duncan mentioned, I wouldn't advice doing this either, as it causes performance and usability issues.
    <a href="http://www.ronaldcirka.com" target="_blank">www.RonaldCirka.com</a><br />
    <a href="http://itunes.apple.com/us/app/equinox/id318815572?mt=8" target="_blank">Equinox</a> |<a href="http://itunes.apple.com/us/app/team-liquid/id381629617?mt=8" target
Sign In or Register to comment.