Animation in objective C -
-(ibaction)nextbuttonaction:(id)sender{ uiview *newview=[[uiview alloc]initwithframe:cgrectmake(0.0f,0.0f,320.0f,416.0f)]; uiimageview *newimageview=[[uiimageview alloc]initwithframe:cgrectmake(0.0,0.0, 320.0,416.0 )]; uiimageview *upperimageview=[[uiimageview alloc]initwithframe:cgrectmake(0.0, 0.0, 320.0,416)]; if(pagecount == 72){ backbarbutton.title=@"about us"; if(img){ [newimageview setimage:[uiimage imagenamed:@"splashscreenhsd.png"]];} else{ [newimageview setimage:[uiimage imagenamed:@"splashscreen.png"]]; } [titlebaritem settitle:@"0/72"]; [newview addsubview:newimageview]; pagecount=0; } else { pagecount++; nsstring *page=[nsstring stringwithformat:@"pagehsd%d.png",pagecount]; nsstring *pagestring=[nsstring stringwithformat:@"page%d.png",pagecount]; if(img){ [upperimageview setimage:[uiimage imagenamed:page]]; } else{ [upperimageview setimage:[uiimage imagenamed:pagestring]]; } if(img){ [newimageview setimage:[uiimage imagenamed:@"backgroundhsd.png"]];} else{ [newimageview setimage:[uiimage imagenamed:@"background.png"]]; } [newimageview addsubview:upperimageview]; [newview addsubview:newimageview]; [titlebaritem settitle:[nsstring stringwithformat:@"%d/72",pagecount]]; aboutusbutton.title=@"back"; } [uiview beginanimations:nil context:nil]; [uiview setanimationduration:1.0]; [uiview setanimationtransition:uiviewanimationtransitioncurlup forview:[self view] cache:no]; [[self view] addsubview:newview]; [uiview commitanimations]; }
i using code , there problem in this, when continue click next button animation gets faster on every click , animation become invisible. tell me solution of problem.
play around animation duration (in seconds). default value 0.2
[uiview setanimationduration:1.0];
Comments
Post a Comment