Discussion Forums  >  Images, Documents, File Locations

Replies: 8    Views: 116

shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
05/11/13 12:39 PM (11 years ago)

How to show 154 image slideshow?

I'm trying to figure out the most efficient way to do this. I have an exercise routine that's made up of 154 images (vector art), each lasting .5 seconds. If it's set as an animated gif or ppt slideshow, it's easy to follow along and looks right. Would the ppt plugin be the way to go, or should I create an animated gif an insert it into a html doc or should I turn it into a video? Also if viewed on an iphone it would work best in portrait, but if you were viewing on an ipad, you'd probably have it on landscape. Any advice?
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/11/13 12:53 PM (11 years ago)
iOS doesn't handle animated gif's properly. If you already have them in a series of still images (png or jpg, but preferably png), then you can use iOS's built in animation settings for imageViews: -(void)startAnimating { UIImage *img1 = [UIImage imageNamed:@"image1.png"]; UIImage *img2 = [UIImage imageNamed:@"image2.png"]; UIImage *img3 = [UIImage imageNamed:@"image3.png"]; NSArray *animatedSplashArray = [[NSArray alloc]initWithObjects:img1, img2, img3, nil]; CGFloat theDuration = (154 * .5); [theImgView setAnimationDuration:theDuration]; [theImgView setAnimationImages:animatedSplashArray]; [theImgView startAnimating]; [self performSelector:@selector(stopAnimation) withObject:nil afterDelay:theDuration]; } -(void)stopAnimation { [theImgView stopAnimating]; }
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/11/13 12:56 PM (11 years ago)
You could also set up a for() loop to add all 154 images with just a few lines of code, rather than typing each out individually.
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
05/11/13 01:08 PM (11 years ago)
Thanks Chris, yes, the images could be in a series, named image1.png, etc and I can sort of understand what your code is doing, but unfortunately I'm not nearly confident enough in xcode to know where and how to add this.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/11/13 01:17 PM (11 years ago)
Maybe the answer is not in the technical aspects of a solution, but in the usability - the way this could be controlled by the user and what is intuitive. To me it sounds like it should be presented as a video (e.g. mp4). I'd use the AT53 player with that, with pause, stop etc controls to control it. Alan
 
chris1
Code is Art
Profile
Posts: 3862
Reg: Aug 10, 2012
Austin, TX
50,120
like
05/11/13 01:27 PM (11 years ago)
ATrain's plugin would work fine if it was in video form. But if it's currently in image form, it would be easier to animate the images. You could also get creative and control the size of the image view. You could still add play, pause and stop buttons. Here's a simple example of how it might work in the BT_screen_blank.m plugin. Replace the entire "viewWillAppear" method with this: //view will appear -(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [BT_debugger showIt:self theMessage:@"viewWillAppear"]; //flag this as the current screen cctimecard_appDelegate *appDelegate = (cctimecard_appDelegate *)[[UIApplication sharedApplication] delegate]; appDelegate.rootApp.currentScreenData = self.screenData; //setup navigation bar and background [BT_viewUtilities configureBackgroundAndNavBar:self theScreenData:[self screenData]]; UIImageView *theImg = [[UIImageView alloc]init]; theImg.frame = self.view.frame; [self.view addSubview:theImg]; [self startAnimating:theImg]; } -(void)startAnimating: (UIImageView *)theImgView { UIImage *img1 = [UIImage imageNamed:@"img1.png"]; UIImage *img2 = [UIImage imageNamed:@"img2.png"]; UIImage *img3 = [UIImage imageNamed:@"img3.png"]; NSArray *animatedSplashArray = [[NSArray alloc]initWithObjects:img1, img2, img3, nil]; CGFloat theDuration = ([animatedSplashArray count] * .5); [theImgView setAnimationDuration:theDuration]; [theImgView setAnimationImages:animatedSplashArray]; [theImgView startAnimating]; [self performSelector:@selector(stopAnimation:) withObject:theImgView afterDelay:theDuration]; } -(void)stopAnimation: (UIImageView *)theImgView { [theImgView stopAnimating]; }
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
05/11/13 01:50 PM (11 years ago)
Wow thanks. I could add stop/pause, but if you stopped or paused the exercise it wouldn't have the same health benefit. You need to sweat it out to the end, Ideally I'd want people to click one button to start - very simple. I do think animating the images may work best, some of the exercise positions last .5 seconds and others are simply holding a position for 10 seconds. For example in an animated gif running at .5 sec, it shows: image 1, the .5-second exercise position, once. And the next exercise (holding a position for 10 seconds) is an image that's duplicated 20 times (image2- image22) to create the 10 second view, etc. until 154 images are viewed.
 
AlanMac
Aspiring developer
Profile
Posts: 2612
Reg: Mar 05, 2012
Esher, UK
37,120
like
05/12/13 07:09 AM (11 years ago)
It will be interesting to hear what solution you end up with. Cheers, Alan
 
shenry
Aspiring developer
Profile
Posts: 469
Reg: Jan 10, 2012
Orange County, ...
13,390
like
05/12/13 10:28 AM (11 years ago)
I think I'm going to try Chris's BT_screen_blank.m plugin idea. I've never worked with the blank screen before.(I'm strictly Buzztouch with training wheels) thanks for your input, I was wondering about video too, but thought it might get too big - about 7 minutes.
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.