Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 09-18-2008, 01:57 PM   #1 (permalink)
New Member
 
Join Date: Sep 2008
Posts: 2
truebluejw is on a distinguished road
Default Image animation

Ok, so forgive me for asking a very very beginner question. I have watched and gone through most of the beginner and intermediate tutorials on this site and they have helped a lot. I've been playing around adding buttons, loading stuff, etc. I am confused on one thing though. I know how to load an image and set it up in imageview, but is there something I need to do to get an animated gif to play the frames? Should I be doing this with individual arrays? I just want to loop this one gif on part of the screen. It plays in the preview, but not in the actual emulator. I've read video doesn't play in the emulator sometimes? Thanks a bunch
truebluejw is offline   Reply With Quote
Old 01-10-2011, 01:59 PM   #2 (permalink)
iDude
 
Join Date: Sep 2010
Location: Lebanon
Posts: 2
ralph.helou is on a distinguished road
Send a message via Yahoo to ralph.helou
Default

Quote:
Originally Posted by truebluejw View Post
Ok, so forgive me for asking a very very beginner question. I have watched and gone through most of the beginner and intermediate tutorials on this site and they have helped a lot. I've been playing around adding buttons, loading stuff, etc. I am confused on one thing though. I know how to load an image and set it up in imageview, but is there something I need to do to get an animated gif to play the frames? Should I be doing this with individual arrays? I just want to loop this one gif on part of the screen. It plays in the preview, but not in the actual emulator. I've read video doesn't play in the emulator sometimes? Thanks a bunch
hey there, to animate using a set of images, first place all the images in a folder and add it to your project. in the viewController.h add:

IBOutlet UIImageView *imageview;

and before the @ end, add:

- (IBAction) startAnimation;

in the viewController.m add the following code:

- (IBAction)animateid)sender{
imageview.animationImages = [NSArray arrayWithObjects:

[UIImage imageNamed:@"image1.png"],
[UIImage imageNamed:@"image2.png"],
[UIImage imageNamed:@"image3.png"],
[UIImage imageNamed:@"image4.png"],
[UIImage imageNamed:@"image5.png"],
[UIImage imageNamed:@"image6.png"],
[UIImage imageNamed:@"image7.png"],
[UIImage imageNamed:@"image8.png"], nil];

[imageview setAnimationRepeatCount:2]; /*how many times you want to repeat the animation*/
imageview.animationDuration = 1; /*set the number of seconds you want the animation to last*/
[imageview startAnimating];
}

Go to the viewController.xib, add an 'image view' to the 'view' then link the imageview from the file's owner to the image view. Second, add a button to the view and link the 'startAnimation' from the file's owner to the button in the view.

cheers.
ralph.helou is offline   Reply With Quote
Old 01-30-2011, 06:11 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2010
Posts: 57
d2bes is on a distinguished road
Default

Quote:
Originally Posted by truebluejw View Post
Ok, so forgive me for asking a very very beginner question. I have watched and gone through most of the beginner and intermediate tutorials on this site and they have helped a lot. I've been playing around adding buttons, loading stuff, etc. I am confused on one thing though. I know how to load an image and set it up in imageview, but is there something I need to do to get an animated gif to play the frames? Should I be doing this with individual arrays? I just want to loop this one gif on part of the screen. It plays in the preview, but not in the actual emulator. I've read video doesn't play in the emulator sometimes? Thanks a bunch
So I think you're trying to get it and load it to a uiimageview. So here it is.

With iPhone SDK:

UIImage *IMG = [UIImage isEqual:@"REC.png"];
[IMG setImage:IMG];

With the Mac SDK:

-(void)configureImage2NSString*)imagePathStr2 {

NSImage* image2 = [[NSImage alloc]initWithContentsOfFile:imagePathStr2];
[img2 setImage:image2];
[image2 release];

}


-(IBAction)display1id)sender {

NSString* imagePathStr = [[NSBundle mainBundle]pathForResource:@"wood" ofType:@"png"];
[self configureImage:imagePathStr];

}


tell me if this is not what you meant.
d2bes is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, gif, image

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 320
6 members and 314 guests
2Apps1Day, akacaj, SLIC, soohyun, Techgirl-52, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,115
Posts: 402,887
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:06 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0