So i\'m trying to pass data between two views (first view is tableViewController,when cell is pressed data is send to second view,second view got imageView, when data is sen
In a class if you want to use a protocal you can use like as :
// this the way too declare a protocal.
// .h file
@protocol TestProtocol
-(void)testMyProtocolMethod:(NSString *)testvalue;
@end
@interface TestProtocolClass: NSObject
{
id delegate;
}
@property (nonatomic , assign) id delegate;
/* synthesize in the .m file of this class*/
@end
//Now you have to use this protocol in any class where you want to use , Do like as:
//let us suppose you want to use this protocal method in a class named "DemoProtocal".
// .h file
import "TestProtocol.h"
@interface DemoProtocal {
}
@end
//.m file
#import "DemoProtocal.h"
@implementation DemoProtocal
- (id)init{
TestProtocol *test = [[TestProtocol alloc]init];
test.delegate = self;
}
-(void)testMyProtocolMethod:(NSString *)testvalue{
// Do appropriate things.
}
@end