ios - Objective C How to animate Subview with click in Button -
i have problem :d.
i'm using splitviewcontroller. @ start want hide tableviewcontroller in masterview. decided add together subview in storyboard tableview, little label shown.
so after create selection in detailview , click button want hide subview , want show tableview. animations.
so here code:
in testtableviewcontroller.m
-(void)animateview{ [uiview beginanimations:nil context:null]; [uiview setanimationduration:0.1]; [uiview setanimationcurve:uiviewanimationcurvelinear]; fixedview.frame=cgrectmake(-500, 0,0,0); [uiview commitanimations]; nslog(@"test"); and in testdetailviewcontroller.m
- (ibaction)attractionbutton:(uibutton *)sender { testtableviewcontroller *testtableviewcontroller = [[testtableviewcontroller alloc]init]; [testtableviewcontroller animateview]; } i nslog "test" animation not working. fixedview subview , drag header file it's iboutlet.
thank far.
the problem is, not referencing same master view controller in details view controller.
you creating 1 in ibaction.
in order hold of (the "original" one) master view controller, in detail view controller:
create ivar:
testtableviewcontroller *masterviewcontroller; and reference it:
masterviewcontroller = (testtableviewcontroller*)[[[self.splitviewcontroller.viewcontrollers lastobject] viewcontrollers] objectatindex:0]; for example:
- (ibaction)attractionbutton:(uibutton *)sender { masterviewcontroller = (testtableviewcontroller*)[[[self.splitviewcontroller.viewcontrollers lastobject] viewcontrollers] objectatindex:0]; [masterviewcontroller animateview]; } and in animateview method, create alter following:
[uiview animatewithduration:0.1f animations:^ { fixedview.frame = cgrectmake(-500, 0, 0, 0); } completion:nil]; hope helps.
ios objective-c subview
No comments:
Post a Comment