我正在设置一个按钮的图像,它不显示。 据我所知将其设置为backgroundImage会将其拉伸为按钮的大小,因此我宁愿使用setImage来代替。为什么我看不到按钮?
self.mainMapButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.mainMapButton setImage:[UIImage imageNamed:@"map_icon"] forState:UIControlStateNormal];
[self.tabView addSubview:self.mainMapButton];
self.mainMapButton.center = CGPointMake((self.tabView.frame.size.width/4)/2, self.tabView.frame.size.height/2);
我的代码出了什么问题?
你试过“backgroundImage”吗?它出现了吗? – anhtu
nope。但想出了为什么.. – durazno
也许帧是不正确的 – anhtu