ios - UIView transitionFromView -
i'm pretty new on ios programming. , i'm stuck @ (i'm sure) simple issue. don't know i'm doing wrong...
-my viewdidload:
[super viewdidload]; cgrect frame = cgrectmake(0, 0, 768, 1024); uiview *uno=[[[uiview alloc] initwithframe:frame] autorelease]; uiimageview *mainview = [[[uiimageview alloc] initwithframe:frame] autorelease]; mainview.image = [uiimage imagenamed:@"photo.jpg"]; [uno addsubview:mainview]; uiview *dos=[[[uiview alloc] initwithframe:frame] autorelease]; uiimageview *mainviewdos = [[[uiimageview alloc] initwithframe:frame] autorelease]; mainviewdos.image = [uiimage imagenamed:@"default.png"]; [dos addsubview:mainviewdos]; // [self.view addsubview:uno]; // [self anima:uno:dos];
and anima method:
-(void) anima:(uiview *)uno:(uiview *)dos{ [uiview transitionfromview:uno toview:dos duration:2.0 options:uiviewanimationoptiontransitionflipfromleft completion:nil]; }
it changes view without transition...
thanks
you can't perform animation within viewdidload--the view changes make in there executed before view displayed, you're seeing.
are trying show animation when view first displayed? if so, can work putting animation on timer. note approach, you'll have refactor anima
method bit take single argument.
in viewdidload:
nsdictionary *views = [nsdictionary dictionarywithobjectsandkeys:uno, @"uno", dos, @"dos", nil]; [self performselector:@selector(anima) withobject:views afterdelay:0.1];
then change anima
method to:
-(void) anima:(nsdictionary *)views { [uiview transitionfromview:[views objectforkey:@"uno"] toview:[views objectforkey:@"dos"] duration:2.0 options:uiviewanimationoptiontransitionflipfromleft completion:nil]; }
Comments
Post a Comment