1. 程式人生 > >button上的圖片顯示藍色

button上的圖片顯示藍色

UIButton *headImg = [UIButtonbuttonWithType:UIButtonTypeCustom];

headImg.frame = CGRectMake((UISCREEN_WIDTH-60)/2, 5, 60, 60);

[headImgsetImage:[UIImageimageNamed:@"我的.png"] forState:UIControlStateNormal];

headImg.layer.masksToBounds = YES;

headImg.layer.cornerRadius = 30;

headImg.layer.borderWidth =

1;

headImg.layer.borderColor = [UIColorredColor].CGColor;

headImg.tag = 2;

[headImgaddTarget:self action:@selector(gotoView:) forControlEvents:UIControlEventTouchUpInside];

[self.view addSubview:headImg];

問題沒有解決前的圖片: