Temporarily Spawning UIImageView

Discussion in 'Mac Programming' started by Narcs, Jan 28, 2012.

  1. Narcs, Jan 28, 2012
    Last edited by a moderator: Jan 29, 2012

    macrumors newbie

    Joined:
    Jan 19, 2012
    #1
    I have a UIImageView called hitBox. And an IBAction called hit. What I want to do is temporarily spawn the hitBox UIImageView hitBox for a fractions of a second.

    Code:
    -(IBAction)hit{
    here is where i temporarily want to spawn hitBox
    }
    Thanks :)
     
  2. robvas, Jan 28, 2012
    Last edited by a moderator: Jan 29, 2012

    macrumors 68000

    Joined:
    Mar 29, 2009
    Location:
    USA
    #2
    Well, you could add a new one by doing something like:

    Code:
    UIImageView *hitbox = [[UIImageView alloc] initWithImage:hitboxImage];
    [self.view addSubview:hitbox];
    [hitbox setFrame:CGRectMake(x,y,hitboxHorizSize, hitboxVertSize)];
     

Share This Page