Note that there are some explanatory texts on larger screens.

plurals
  1. POcall selector in parent from UITableView delegate class
    primarykey
    data
    text
    <p>Ok, I've been on this for a couple of hours now and figured it was time to reach out. For my first time I'm working with multiple tableviews (2) on one storyboard. I setup the storyboard with its own view controller (main view controller). The first table I delegated to the main view controller as the common pattern. For the second table view I setup a separate class as the delegate and delegated to for tableview and datasource.</p> <p>Things look good, each tableview loads and displays the correct data, etc. All good so far.</p> <p>Here is the rub, on the second tableview - the externally delegated one, I want to take an action when a row is selected via: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath blah,blah,blah.</p> <p>the desired action is to initiate a segue to a new view controller that is connected to "main view controller". I have a selector in the main view controller that has the perform segue action (which otherwise works)</p> <p>I can't figure out how to establish a connection back from the delegate to main view controller so I can call the correct selector which will then initiate the segue. Typically between segues I use segue.parent.. segue.destination...., etc. They do not work in this situation. I can't segue from the delegate class because the segue is not connected to the delegate. </p> <p>I've tried this approach but it does not work: StartViewController:</p> <pre><code>VisitListDelegate = [[VisitsMainPageDelegate alloc] init]; [self.iboVisitsTableView setDelegate:self.VisitListDelegate]; [self.iboVisitsTableView setDataSource:self.VisitListDelegate]; LocalVisits *LV = [[LocalVisits alloc] init]; //datasource VisitListDelegate.visits = [LV getLocalVisits]; //sets variable in delagate </code></pre> <p>Delegate class called VisitsMainPageDelegate</p> <pre><code>#import &lt;UIKit/UIKit.h&gt; @class StartViewController; @interface VisitsMainPageDelegate : UIViewController &lt;UITableViewDelegate,UITableViewDataSource&gt; { StartViewController *sourceParent; } @property (nonatomic,retain) StartViewController *sourceParent; @property (nonatomic,strong) NSMutableArray *visits; @end </code></pre> <p>then try to reference it like this:</p> <pre><code>[sourceParent jumpToVistDetailsForThisVisit:@"test"]; </code></pre> <p>I do not get errors but it does not work.</p> <p>Any help towards solving this would be much appreciated.</p> <p>thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload