Animation not playing after dismissViewController iOS -
i have "aviewcontroller
" root viewcontroller
, have image playing animation infinite loop.
- (void)rotateimageview { [uiview animatewithduration:1 delay:0 options:uiviewanimationoptioncurvelinear animations:^{ [self.imageviewspin settransform:cgaffinetransformrotate(self.imageviewspin.transform, m_pi_2)]; }completion:^(bool finished){ if (finished) { [self rotateimageview]; } }]; }
in viewwillappear
-(void)viewwillappear:(bool)animated{ [super viewwillappear:animated]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(rotateimageview) name:uiapplicationwillenterforegroundnotification object:nil]; [self rotateimageview]; }
this work great if application become active. when i'm try presentviewcontroller "cviewcontroller
" [self.navigationcontroller presentviewcontroller: animated: completion:]
, have button on "cviewcontroller
"
[self dismissviewcontrolleranimated:yes completion:^{ [[nsnotificationcenter defaultcenter] postnotificationname:@"checkispresent" object:self]; }];
after returning "aviewcontroller
",animation stops working. how solve issue. thank you.
edit.
work put [self rotateimage];
in method postnotification.
-(void)viewwillappear:(bool)animated{ [super viewwillappear:animated]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(rotateimageview) name:uiapplicationwillenterforegroundnotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(checkpresentview) name:@"checkispresent" object:nil]; [self rotateimageview]; } -(void)checkpresentview{ //ismodalview = false; [self rotateimageview]; }
Comments
Post a Comment