iphone - Pass CGPoint in Notification of iOS -
i want send cgpoint maincontroller class. using notification send cgpoint dont know how extract cgpoint notification @ receiver. 0.00 on log output.
here code.
at sender:
nsvalue *pointasobject =[nsvalue valuewithcgpoint:cgpointmake(touchdetectingview.lasttouchposition.x, touchdetectingview.lasttouchposition.y)]; [[nsnotificationcenter defaultcenter] postnotificationname: @"swap" object:pointasobject];
at receiver header file:
- (void)incomingnotification:(nsnotification *)notification;
at receiver m file
[super viewdidload]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(incomingnotification:) name:@"swap" object:nil]; - (void)incomingnotification:(nsnotification *)notification { nsvalue *pointasobject = [[notification userinfo] valueforkey:@"swap"]; nslog (@"successfully received test notification %f",pointasobject.cgpointvalue.y); }
but 0.00 output ..
- (void)incomingnotification:(nsnotification *)notification { nsvalue *pointasobject = [notification object]; nslog (@"successfully received test notification %f",pointasobject.cgpointvalue.y); }
Comments
Post a Comment