ios - Changing views in a view Controller -


so want make app 7 min workout, during workout view changes different exercise consists of image, timer , label displays exercise name. happens automatically example is,

view 1. image shown of person doing push up, timer of 30 seconds displayed, title called table. after 30 seconds transitions new view. view 2. same above different pictures , titles view 3..... , on.

i dont think necessary make different view controllers exercises, guys have suggestions on need make this.

try

#import "viewcontroller.h"  @interface viewcontroller () { uiview *baseview; uilabel *titlelabel; uiimageview *viewforpic; float fadeduration; nsmutablearray *infoarray ; } @end  @implementation viewcontroller  - (void)viewdidload { [super viewdidload];   nsarray *imagesarray=[[nsarray alloc]initwithobjects:@"red.png",@"blue.png",@"yellow.png",  nil]; nsarray *titlearray =[[nsarray alloc]initwithobjects:@"red",@"blue",@"yellow", nil];  infoarray =[[nsmutablearray alloc]init]; (int i=0; i<imagesarray.count; i++) {     nsmutabledictionary *dict =[[nsmutabledictionary alloc]init];     [dict setobject:imagesarray[i] forkey:@"images"];     [dict setobject:titlearray[i] forkey:@"titles"];     [infoarray addobject:dict];   //  [dict removeobjectsforkeys:keys]; } nslog(@"%@",infoarray);  baseview=[[uiview alloc]initwithframe:cgrectmake(0, 0, 320, 380)]; [self.view addsubview:baseview]; titlelabel =[[uilabel alloc]initwithframe:cgrectmake(0, 0, 320, 60)]; titlelabel.textalignment=nstextalignmentcenter; [baseview addsubview:titlelabel]; viewforpic =[[uiimageview alloc]initwithframe:cgrectmake(0, 60, 320, 320)]; [baseview addsubview:viewforpic];  [self showanimationwithinfor:0];  }  -(void)showanimationwithinfor :(int)tempindex { titlelabel.text=[infoarray[tempindex] objectforkey:@"titles"]; viewforpic.backgroundcolor= [uicolor redcolor];  //[temp[0] objectforkey:@"images"];  [uiview animatewithduration:10.0f animations:^{     baseview.alpha = 1.0f; } completion:^(bool finished){     [uiview animatewithduration:10.0f animations:^{         baseview.alpha = 0.0f;         if (infoarray.count>tempindex+1) {          int tempedindex=tempindex+1;             [self showanimationwithinfor:tempedindex];         }     }]; }]; } @end 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -