ios - addSubview turning my view to default -


it seems when use addsubview add image viewcontroller, view turned it's view when loads. reason why , how fix? here's code if needed:

 let target = targets[i]  bullet = uiimageview(image: uiimage(named:"bullethole"))  bullet.frame = cgrectmake(target.center.x,target.center.y,20,20)  bullet.hidden = false  self.view.addsubview(bullet) 

your image not moving seems due view inheritance line self.view.addsubview(bullet) expresses. this, pasting image onto whole view itself. if want move image have 2 options:

  1. move bullet hole same way move other image, or

  2. add bullet hole subview of view moving, not main view (as in self.view)


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -