ios - How to update the background of a UIImageVIew? -


solved: turn off auto-layout , use springs-struts

i have pong type game i've been experimenting uses 3 uiimageview objects xib file. 1 uiimageview ball, bouncing around screen via nstimer object, , other 2 "paddles".

when user taps screen, ball starts moving. dragging finger up-and-down moves right side paddle. paddle uses 10x60 png file background. when user taps screen, ball in motion, wanted temporarily change background on paddle visual effect. problem is, changing background of paddle seems reset positions of uiimageviews on screen. there esoteric property of ios resets view or when background changed or doing wrong?

.h file

@property (weak, nonatomic) iboutlet uiimageview *paddleleft; @property (weak, nonatomic) iboutlet uiimageview *paddleball; @property (weak, nonatomic) iboutlet uiimageview *paddleright; 

.m file

@synthesize paddleright; @synthesize paddleleft; @synthesize paddleball; 

...

- (void) touchesbegan:(nsset *)touches withevent:(uievent *)event {     nslog (@"touches began");      if (self.paused)     {         self.paused = no;         nslog (@"ball launch");     }     else     {         // hilite paddle different 10x60 image         self.paddleright.image = [uiimage imagenamed:@"rect_2.png"];     } } 

turn off auto-layout , use springs-struts


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -