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-17-2010, 08:21 PM   #1 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 98
rTicker is on a distinguished road
Default How To Make A Moving Image?

How do I make a UIImageView that constantly goes right to left while the view is open?
rTicker is offline   Reply With Quote
Old 09-17-2010, 08:41 PM   #2 (permalink)
cye
14 Year Old App Developer
 
Join Date: Mar 2010
Location: Texas
Posts: 242
cye is on a distinguished road
Default

Quote:
Originally Posted by rTicker View Post
How do I make a UIImageView that constantly goes right to left while the view is open?
Use a NSTimer. Move the UIImageView move everytime the timer ticks
__________________
14 year old app developer!

Type Faster and More Accurately With Easy Typing

"Like" me on facebook!

A+ FlashCards currently #6 Free Education app


Confidence is contagious. So is lack of confidence.
-- Vince Lombardi
cye is offline   Reply With Quote
Old 09-18-2010, 07:16 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 98
rTicker is on a distinguished road
Default

What's the code to move the image? I mean what do I put in the -(void) That the timer is calling?
rTicker is offline   Reply With Quote
Old 09-18-2010, 09:01 AM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by rTicker View Post
What's the code to move the image? I mean what do I put in the -(void) That the timer is calling?

myImageView.frame = CGRectMake(myImageView.frame.origin.x, myImageView.frame.origin.y, myImageView.size.width, myImageView.size.height);

you must only increment the x, and when it is > Z, you will set to 0.
__________________
dany_dev is offline   Reply With Quote
Old 09-18-2010, 12:04 PM   #5 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 98
rTicker is on a distinguished road
Default

I am getting an error: request for member 'size' in something not a structure or union

With this code put in a -(void) that a timer is calling. Please Help Me!

four.frame = CGRectMake(four.frame.origin.x, four.frame.origin.y, four.size.width, four.size.height);
rTicker is offline   Reply With Quote
Old 09-18-2010, 12:07 PM   #6 (permalink)
iPhone SDK learner
 
Join Date: Feb 2010
Location: Illinois, USA
Posts: 421
Batman is on a distinguished road
Default

Quote:
Originally Posted by rTicker View Post
I am getting an error: request for member 'size' in something not a structure or union

With this code put in a -(void) that a timer is calling. Please Help Me!

four.frame = CGRectMake(four.frame.origin.x, four.frame.origin.y, four.size.width, four.size.height);
UIImageViews do not have a property called 'size'. CGRect does though, so

Code:
four.frame = CGRectMake(four.frame.origin.x, four.frame.origin.y, four.frame.size.width, four.frame.size.height);[/quote]
__________________
Fast Flash Cards
Available on the App Store
Fast Flash Cards
Batman is offline   Reply With Quote
Old 09-18-2010, 12:56 PM   #7 (permalink)
Registered Member
 
Join Date: Oct 2008
Posts: 247
c0der is on a distinguished road
Default

It's much easier to set up an animation block with SetAnimationRepeatCount = FLT_MAX. No NSTimer required!

Last edited by c0der; 09-18-2010 at 01:00 PM.
c0der is offline   Reply With Quote
Old 09-18-2010, 01:14 PM   #8 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by Batman View Post
UIImageViews do not have a property called 'size'. CGRect does though, so

Code:
four.frame = CGRectMake(four.frame.origin.x, four.frame.origin.y, four.frame.size.width, four.frame.size.height);
Code:

[/quote]

thanks, i wrote without checking
__________________
dany_dev is offline   Reply With Quote
Old 09-18-2010, 04:41 PM   #9 (permalink)
Registered Member
 
Join Date: Aug 2010
Posts: 98
rTicker is on a distinguished road
Default

I put the following codeine the -(void) that the timer calls. I got no errors but when I run the app it doesn't move a bit. I want it to go right to left.

four.frame = CGRectMake(four.frame.origin.x, four.frame.origin.y, four.frame.size.width, four.frame.size.height);
rTicker is offline   Reply With Quote
Old 09-20-2010, 04:57 AM   #10 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by rTicker View Post
I put the following codeine the -(void) that the timer calls. I got no errors but when I run the app it doesn't move a bit. I want it to go right to left.

four.frame = CGRectMake(four.frame.origin.x, four.frame.origin.y, four.frame.size.width, four.frame.size.height);
mmm.....try to undestand what are you doing.

you are setting a new frame for you view, it consist of a X (you know what it represent no?) a Y, a width (that not must change), and a height (that not must change). So maybe if you set the x of something as the old x, you will not see nothing move.
__________________
dany_dev is offline   Reply With Quote
Old 09-20-2010, 12:32 PM   #11 (permalink)
I will be a billionaire.
 
IphoneSdk's Avatar
 
Join Date: Sep 2009
Location: Scarborough, United Kingdom
Age: 17
Posts: 1,344
IphoneSdk is on a distinguished road
Default

Let me google that for you

Wasn't that hard I don't think, there are tons of solutions. Videos from YouTube will probably be best. Most of them set the image moving across the whole screen. So you just need to set the coordinates to just go across the screen (or whatever you want).
__________________
iOS Apps | Website | Twitter | Facebook
IphoneSdk is offline   Reply With Quote
Reply

Bookmarks

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: 305
15 members and 290 guests
2ndSegment, cayladv57, cgokey, dermotos, djohnson, Domele, Hamad, heshiming, linkmx, markuschow, pungs, Sloshmonster, teebee74, v1n2e7t
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

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