I have implemented NSNotificationCenter in my application. I send notification when ever image decoding is done. first time the image decoding will be done 8 times.So the notification suppose to send 8 times.But it is calling 64 times(8*8).
Here is my code how i have implemented--> // Initialisation
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(getHRImage:)
name:@"DecodeComplete" object:nil];}
//Calling Method
-(void)getHRImage:(NSNotification *) notification
{
if ([[notification name] isEqualToString:@"DecodeComplete"])
NSLog (@"Successfully received the DecodeComplete notification! ");
}`
// Deallocation
- (void) dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"DecodeComplete" object:self];
//[super dealloc];
}
//Post Notification
[[NSNotificationCenter defaultCenter] postNotificationName:@"DecodeComplete" object:self];
Some one can suggest me where I have done wrong.
Thanks in advance.
//Calling Method is like this (calling 8 times)
-(void)decode
{
NSLog(@"---------- Decoding is Complete ---------");
[[NSNotificationCenter defaultCenter] postNotificationName:@"MdjDecodeComplete" object:self];
}