ios - CGPointMake Accuracy -



ios - CGPointMake Accuracy -

i have created scene have character image move throughout circle have created.

the character image view , box containing circle image view.

as of right have image moving throughout entire scene. how limit motion within circle?

here code have far:

.h

@interface finalprojectviewcontroller : uiviewcontroller { iboutlet uiimageview *romo; cgpoint pos; nstimer *romomove; } -(void)romomoving;

.m

- (void)viewdidload { romomove = [nstimer scheduledtimerwithtimeinterval:0.09 target:self selector:@selector(romomoving) userinfo:nil repeats:yes]; pos = cgpointmake(5.0, 4.0); } -(void)romomoving { romo.center = cgpointmake(romo.center.x+pos.x, romo.center.y+pos.y); if (romo.center.x>170||romo.center.x<0) { pos.x = -pos.x; } if (romo.center.y>180||romo.center.y<0) { pos.y = -pos.y; } }

i thinking best way go find points of circle character nail set points should move to. not sure if best way this, nor sure on how accomplish this.

ios objective-c xcode5

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

SQL Server : need assitance parsing delimted data and returning a long concatenated string -