Why UIImageView not round corner?

Discussion in 'iOS Programming' started by mikezang, May 4, 2012.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    I have a UIImageView on UIView, I use code as below to draw round corner, but it doesn't work, what can I do?
    Code:
        self.icon.image = [UIImage imageNamed:@"icon-72.png"];
        self.icon.layer.masksToBounds = YES;
        self.icon.layer.cornerRadius = 10.632f;
    
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
  3. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #3
    I found reason, that doesn't show round corner in Simulator, but show it on my iPhone4S, is this a bug about Simulator?
     

    Attached Files:

  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    I wouldn't consider a bug so much as just a shortcoming of the simulator... the simulator can't run the exact same binary as the iPhone because the CPU in Mac is different from that of an iOS device. To do final software tests, always do it on an actual iOS device, not the simulator.
     
  5. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #5
    You are right! But I am still not sure why this simple effetion can not be drawed in Simulator...
     

Share This Page