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-26-2009, 03:46 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 35
sirvin is on a distinguished road
Exclamation Randomize Rotation with CGAffineTransformMakeRotation

I am trying to make an arrow spin using CGAffineTransformMakeRotation and it works if I hard code a number, but when i try passing it a variable, it gives the error: "error: incompatible type for argument 1 of 'CGAffineTransformMakeRotation'". I thought the data type it took was CGFloat but that doesn't work. How do I fix this?

Code:
CGFloat *angle = random() % 100;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[arrow setTransform:CGAffineTransformMakeRotation (angle)];
[UIView commitAnimations];
sirvin is offline   Reply With Quote
Old 08-26-2009, 03:48 PM   #2 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

the angle should be in radians, probably between 0 and 2 PI

edit: Also you change CGFloat* to just CGFloat
smithdale87 is offline   Reply With Quote
Old 08-26-2009, 03:51 PM   #3 (permalink)
Registered Member
 
Join Date: Aug 2009
Posts: 35
sirvin is on a distinguished road
Smile

OMG! Thank you, it works now. All I had to do was take out the asterisk!
sirvin is offline   Reply With Quote
Old 08-26-2009, 04:48 PM   #4 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 24
Posts: 3,983
smithdale87 is on a distinguished road
Send a message via AIM to smithdale87
Default

awesome. you're welcome
smithdale87 is offline   Reply With Quote
Reply

Bookmarks

Tags
cgaffinetransform, random, rotation

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: 327
13 members and 314 guests
chiataytuday, 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:28 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0