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 08-30-2009, 09:08 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 11
stirkles17 is on a distinguished road
Post animating UIImageView

Hi...

I have this animation image... and I have no idea on how to animate it...

however I don't just want it to animate when the application begins as it is a feature of a button being pressed directly above it...

Also I want the animation to reapeat but only a few times...

Then after I get the animation working I need the button to work with 2 labels on a ratio basis... soooo the way I want it is that one label will be the concluding answer for about 80% of the button pushes where as the 20% would pop up more rarely to give my application an edge...

can someone please help as I am desperate and cannot find anywhere in my apress book and the posts on the forums just stress me out and confuse me...

*cries*
stirkles17 is offline   Reply With Quote
Old 08-30-2009, 12:59 PM   #2 (permalink)
Registered Member
 
ChrisMayer's Avatar
 
Join Date: Aug 2009
Posts: 238
ChrisMayer is on a distinguished road
Default here's some of my code which does

I use this code for the animation in my app 'My Blue Screen'

bsTitleAnimation.animationImages = [NSArray arrayWithObjects:
[UIImage imageNamed:@"bootframe01.png"],
[UIImage imageNamed:@"bootframe01.png"],
[UIImage imageNamed:@"bootframe02.png"],
[UIImage imageNamed:@"bootframe03.png"],
[UIImage imageNamed:@"bootframe04.png"],
[UIImage imageNamed:@"bootframe05.png"],
[UIImage imageNamed:@"bootframe05.png"],
[UIImage imageNamed:@"bootframe05.png"],

[UIImage imageNamed:@"bootframe06.png"],
[UIImage imageNamed:@"bootframe07.png"],
[UIImage imageNamed:@"bootframe08.png"],
[UIImage imageNamed:@"bootframe06.png"],
[UIImage imageNamed:@"bootframe07.png"],
[UIImage imageNamed:@"bootframe08.png"],
[UIImage imageNamed:@"bootframe06.png"],
[UIImage imageNamed:@"bootframe07.png"],
[UIImage imageNamed:@"bootframe08.png"],

[UIImage imageNamed:@"bootframeB.png"],
[UIImage imageNamed:@"bootframeB.png"],
[UIImage imageNamed:@"bootframe09.png"],
[UIImage imageNamed:@"bootframe09.png"],
[UIImage imageNamed:@"bootframe09.png"],
[UIImage imageNamed:@"bootframe09.png"],
[UIImage imageNamed:@"bootframe09.png"],
[UIImage imageNamed:@"bootframe09.png"],
[UIImage imageNamed:@"bootframe10.png"],
[UIImage imageNamed:@"bootframe10.png"],
[UIImage imageNamed:@"bootframe10.png"],
[UIImage imageNamed:@"bootframe10.png"],
[UIImage imageNamed:@"bootframeB.png"],

[UIImage imageNamed:@"bootframe11.png"], nil];
bsTitleAnimation.animationDuration=6;
bsTitleAnimation.animationRepeatCount=1;
bsTitleAnimation.image = [UIImage imageNamed:@"bootframe11.png"];
[bsTitleAnimation startAnimating];

replace bsTitleAnimation with whatever your UIImageView is named. animationDuration is the number of seconds in total that the animation will last, and animationRepeatCount is the number of times it will loop, you can also set this to 0 to loop forever.
__________________
ChrisMayer is offline   Reply With Quote
Old 08-30-2009, 03:07 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: US
Posts: 31
shad1236 is on a distinguished road
Default

Generate a random number between 0 and 9.

you can use
int x = arc4random()%10
if(x < 8)
use the label that you want for 80% pushes
else
use other label
shad1236 is offline   Reply With Quote
Old 08-30-2009, 06:15 PM   #4 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 11
stirkles17 is on a distinguished road
Smile confusion :D

Thank you guys!!

ill try them out tomorrow and write back on how it goes

errm shad123456... ur post has confused me slightly...

also... ill have to connect all this up right...

the button with the UIImage so that the animation starts wen the user holds the button... and then connect the button to the 2 labels with the code for the percentage differences??

confusing... as i am neeew n iv only made one independent app so far and it was a simple viewfield, background click t make the keyboard go away and save text when done...
stirkles17 is offline   Reply With Quote
Old 08-30-2009, 06:25 PM   #5 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: US
Posts: 31
shad1236 is on a distinguished road
Default probabilities..

Quote:
Originally Posted by stirkles17 View Post
Thank you guys!!

ill try them out tomorrow and write back on how it goes

errm shad123456... ur post has confused me slightly...

also... ill have to connect all this up right...

the button with the UIImage so that the animation starts wen the user holds the button... and then connect the button to the 2 labels with the code for the percentage differences??

confusing... as i am neeew n iv only made one independent app so far and it was a simple viewfield, background click t make the keyboard go away and save text when done...
You had a question that on button push you want a couple of actions to be triggered. One of the action should happen 80% of the times and the action happens 20% of the times.

In the code for button push

-(IBAction) pressButtonid) sender {
int x = arc4random() % 10;
if( x < 8) //80% probability of this happening
{
//perform the action which needs to occur 80% times
//[self actionwithgreaterprobability];
}
else //20% probability of this happening
{
//other action
//[self otherAction];
}
}
shad1236 is offline   Reply With Quote
Old 08-30-2009, 07:59 PM   #6 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 11
stirkles17 is on a distinguished road
Smile

Quote:
Originally Posted by shad1236 View Post
You had a question that on button push you want a couple of actions to be triggered. One of the action should happen 80% of the times and the action happens 20% of the times.

In the code for button push

-(IBAction) pressButtonid) sender {
int x = arc4random() % 10;
if( x < 8) //80% probability of this happening
{
//perform the action which needs to occur 80% times
//[self actionwithgreaterprobability];
}
else //20% probability of this happening
{
//other action
//[self otherAction];
}
}

You are a star!! thank you soooo much. would have given up if it wasnt for you guys!! THANK YOU!!!!!!!

as u can tell im happy...

just write these into the .h file?? any synthesize needed in .m files or anythng??

just errors stress me out :P
stirkles17 is offline   Reply With Quote
Old 08-30-2009, 08:05 PM   #7 (permalink)
Registered Member
 
Join Date: Aug 2009
Location: US
Posts: 31
shad1236 is on a distinguished road
Default

Quote:
Originally Posted by stirkles17 View Post
You are a star!! thank you soooo much. would have given up if it wasnt for you guys!! THANK YOU!!!!!!!

as u can tell im happy...

just write these into the .h file?? any synthesize needed in .m files or anythng??

just errors stress me out :P
-(IBAction) pressButtonid) sender; goes in .h
and the code in .m
shad1236 is offline   Reply With Quote
Old 08-31-2009, 08:21 AM   #8 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 11
stirkles17 is on a distinguished road
Talking

Quote:
Originally Posted by shad1236 View Post
-(IBAction) pressButtonid) sender; goes in .h
and the code in .m
hey shad1236

Where is the code??

iv added the .h code and it all looks very promising

me = very happy

but im wondering if by the .m code... if its what the other guy has posted ??

errrm comes up with 2 errors...

one in delegate.m which is method definition not in @implementation context

and another in the .m file which says the same as in the delegate file...

Last edited by stirkles17; 08-31-2009 at 08:49 AM. Reason: add more
stirkles17 is offline   Reply With Quote
Old 03-26-2010, 06:55 PM   #9 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 1
empidopreld is on a distinguished road
Default Free Rapidshare Accounts ? WTF LOL ?

Hey guys check out this site I found Welcome To FreeRapidsharePremium! - FREE Rapidshare Premium Accounts for YOU!, damn I JUST got a free premium account and it worked lol, i tried again but this time it gave me an expired account.
Anybody wanna check it out and tell me if its still giving away accounts ? Cuz the first account worked ! :S
Sorry mods if its wrong section, move it wherever.
empidopreld is offline   Reply With Quote
Reply

Bookmarks

Tags
animation, game, label, uiimage, view

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: 323
12 members and 311 guests
coolman, givensur, glenn_sayers, guusleijsten, ipodphone, jbro, mediaspree, mottdog, mtl_tech_guy, Punkjumper, vilisei, whitey99
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

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