Tuesday, 22 March 2011

using CGPointMake in relation to other objects


i have uiimageview called hitbox, , image called mainsprite. wanna when ibaction pressed, move hitbox above mainsprite. don't know if syntax know moves things on screen.

code:
hitbox.center = cgpointmake(x coordinate, y coordinate);
i want replace x coordinate , y coordinate place somewhere in relation mainsprite.

:)
 

to move hitbox above mainsprite, have calculate height of each, , divide 2 if want hitbox sit right on top of mainsprite. use new value y coordinate after subtracting y value of mainsprite. align center of each, assign x center point new center hitbox.

if want cover mainsprite hitbox, have change place in appear in superview hierarchy. @ following methods in uiview class.

code:
 bringsubviewtofront: sendsubviewtoback: exchangesubviewatindex:withsubviewatindex: insertsubview:abovesubview: insertsubview:belowsubview: 
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment