objective c - Pass Button object to method -
i trying write generic method allow me pass following: "x", "y" "object" , have move. have this:
-(void) changeobjectlocations: (integer_t) xspot: (integer_t) yspot: (id) sender { if (![sender iskindofclass:[uibutton class]]) { uibutton *myobject = (uibutton *)sender; [uiview animatewithduration:1.5 animations:^{ cgrect newframe = myobject.frame; newframe.origin.x = xspot; newframe.origin.y = yspot; myobject.frame = newframe; }]; } else if (![sender iskindofclass:[uilabel class]]) { uilabel *myobject = (uilabel *)sender; [uiview animatewithduration:1.5 animations:^{ cgrect newframe = myobject.frame; newframe.origin.x = xspot; newframe.origin.y = yspot; myobject.frame = newframe; }]; } }
i want call so:
-(void) orientationblocklandscape { [self changeobjectlocations: 456 :282 : btn1] ; [self changeobjectlocations: 391 :227 : lbltitle] ; }
although working, on compile following warning:
secondviewcontroller.m:33: warning: 'secondviewcontroller' may not respond '-changeobjectlocations:::'
is there better way can/should passing object? in advance , help.
geo...
based on warning outputted, sounds didn't define changeobjectlocations
in header of secondviewcontroller -- or it's not same signature you've implemented.
Comments
Post a Comment