您的位置:首页 > 产品设计 > UI/UE

iOS UIButton imageView图片无法显示

2015-01-20 17:21 323 查看
在设置UIButton时发现加入的图片不能显示,通过调试发现imageView的hidden属性为YES,并且frame为0。
所以,在建立一个button后要手动设置一下它的imageView.hidden和imageView.frame属性,方可正常显示图片。

//分享按钮
        self.shareBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width, 0, self.height, self.height)];
        self.shareBtn.backgroundColor = [UIColor redColor];
        self.shareBtn.imageView.frame = self.shareBtn.bounds;
        self.shareBtn.hidden = NO;
        self.shareBtn.imageView.image = [UIImage imageNamed:@"btn_forwarding_focused.png"];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐