我从一个角度向另一个使用代表的人传递了一些信息,然而,在我选择一个表象小组时,我向代表传递了数据,以便把信息反馈到对 st的看法中,从而回过了这一观点,但在意见改变时,实际上并没有进入代表方法。
在这方面,我设立了我的代表。
注
#import <UIKit/UIKit.h>
@protocol PassSubSearchData <NSObject>
@required
- (void) setModSearchFields:(NSArray *)modArray modIndexPath:(NSIndexPath *)modIndexPath setSubMod:(NSArray *)subModArray subModIndexPath:(NSIndexPath *)subModIndexPath;
@end
//...
//Delegate for passing Model and SubModel data back to VehicleSearchViewController
id <PassSubSearchData> delegate;
//...
//Delegate for passing Model and SubModel data back to VehicleSearchViewController
@property (strong) id delegate;
页: 1
SubViewController.m
#import "MainViewController.h"
#import "SubViewController.h"
@implementation VehicleSubResultViewController
//...
//Delegate for passing Model and SubModel data back to VehicleSearchViewController
@synthesize delegate;
//...
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//Access selected cells content (cell.textLabel.text)
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
//Predicates restrict the values that will be returned from the query
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K like %@",@"SUB",cell.textLabel.text];
filterArray = [parsedDataArrayOfDictionaries filteredArrayUsingPredicate:predicate];
[[self delegate] setModSearchFields:tempModArray modIndexPath:tempModIndexPath setSubMod:filterArray subModIndexPath:indexPath];
//This pops to the VehicleSearchViewController view
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
}
然后从主要角度来看
MainViewController.h
#import "SubViewController.h"
@interface VehicleSearchViewController : UITableViewController <PassSubSearchData> {
//...
主要意见 然而,法典的这一部分从未接触过。
- (void) setModSearchFields:(NSArray *)modArray modIndexPath:(NSIndexPath *)modIndexPath setSubMod:(NSArray *)subModArray subModIndexPath:(NSIndexPath *)subModIndexPath
{
modObjectString = [[modArray valueForKey:@"MOD"] objectAtIndex:0];
modIndexPath = modIndexPath; // Sets the selected IndexPath from the subview
subModObjectString = [[modelArray valueForKey:@"SUBMODEL"] objectAtIndex:0];
subModIndexPath = subModResultIndexPath; // Sets the selected IndexPath from the subview
NSLog(@"%@", modObjectString);
NSLog(@"%@", modIndexPath);
NSLog(@"%@", subModObjectString);
NSLog(@"%@", subModIndexPath);
[self.tableView reloadData];
}
因此,如果任何人知道任何帮助,我就不敢肯定我所失踪的人。