PDA

View Full Version : random placement on screen




macfanboy
Jul 28, 2008, 01:29 PM
Wirelessly posted (Mozilla/5.0 (iPod; U; CPU iPhone OS 2_0 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A347 Safari/525.20)

how would I put a shape on a random position? I can put it at a random point from 0 to 480 (height) and 0 to 320 (width) but it would change the size



xsmasher
Jul 28, 2008, 01:51 PM
Can you post the lines of code you're using to draw the image, or to set it's frame?

You want change frame.origin.x and frame.origin.y, but leave frame.size.width and frame.size.height alone. It sounds like you're changing the size, but not the origin.

macfanboy
Jul 28, 2008, 02:27 PM
Wirelessly posted (Mozilla/5.0 (iPod; U; CPU iPhone OS 2_0 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Version/3.1.1 Mobile/5A347 Safari/525.20)

I haven't written the code yet because Im on vacation. I just used logic to realize this would happen but couldn't find an easy solution to it. Thank you for helping. It seems like it will work now.