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:
move bullet hole same way move other image, or
add bullet hole subview of view moving, not main view (as in
self.view
)
Comments
Post a Comment