button上的圖片顯示藍色
阿新 • • 發佈:2019-01-01
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 =
headImg.layer.borderColor = [UIColorredColor].CGColor;
headImg.tag = 2;
[headImgaddTarget:self action:@selector(gotoView:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:headImg];
問題沒有解決前的圖片: