我想通过一些数据回到我的UIView,它的高频复杂的情况我会尝试解释它。协议和委托不访问方法
我有我的
mainViewController // request is made to RequestClass
requestClass // Request is sent off to DB for data, data is returned then passed to seriesDataClass
seriesDataClass // sorts the data and then sends back the needed info to mainViewController using protocol & delegates
这是我的代码是什么样子设立协议和委托
mainViewController.h
#import "SeriesDataClass.h"
@interface MatchingSeriesViewController : UIViewController <GetSeriesViewParsedData>
{
mainViewController.m
#import "SeriesDataClass.h"
// this is where I set up my protocols delegate.
- (void)viewDidLoad
{
//..
// get delegate ready
SeriesDataClass *seriesDataClass = [[SeriesDataClass alloc] init];
[seriesDataClass setDelegate:self];
//..
// pass data over to requestClass so you can get the info from the DB
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
//..
[requestClass GetSeries:requestID];
//..
}
requestClass.m
// dose a bunch of stuff then calls seriesDataClass and passes all of its information over to it
//..
SeriesDataClass *seriesDataClass = [[SeriesDataClass alloc] init];
[seriesDataClass recivedData:uncompressedData];
//..
seriesDataClass.h
#import <Foundation/Foundation.h>
// This passes data back to the mainViewController
@protocol GetSeriesViewParsedData <NSObject>
- (void)sendGetSeriesArrays:(NSDictionary *)series LSeries:(NSDictionary *)lSeries;
@end
@interface SeriesDataClass : NSObject <NSXMLParserDelegate> {
//..
}
@property (assign, nonatomic) id <GetSeriesViewParsedData> delegate;
seriesDataClass.m
@implementation SeriesDataClass
@synthesize delegate;
// then in a method later on i call the delegate to pass the information back to mainViewController but this dosnt do anything atm.
//..
[self.delegate sendGetSeriesArrays:seriesDictionary LSeries:lSeriesDictionary];
//..
mainViewController.m
// then back in the mainViewController class I Have the method
- (void)sendGetSeriesArrays:(NSDictionary *)series LSeries:(NSDictionary *)lSeries {
// this method is never accessed
}
所以我的问题是我失去了在它没有被正确的工作该协议/ delgate的设置什么?
我希望问题的结构是有道理的,如果你需要更多的信息,请让我知道。
您是否有任何关于如何执行此操作的线索我甚至不知道在Google上搜索的内容与我遇到的问题。 – HurkNburkS
@HurkNburkS,看我的编辑。 – rdelmar
好吧凉爽去慢慢阅读它,然后尝试实施它我可能是15分钟:P感谢编辑:P – HurkNburkS