我正在制作一个‘信息’按钮,使用Xcode的内置按钮类型"UIButtonTypeInfoLight“。
这是我的代码:
self.helpButton= [UIButton buttonWithType:UIButtonTypeInfoLight];
[self.helpButton addTarget:self
action:@selector(showHelp)
forControlEvents:UIControlEventTouchUpInside];
self.helpButton.frame = CGRectMake(280.0, 440.0, 20, 20);
[self.view addSubview:self.helpButton];然而,有一个问题。我的应用程序包含一个滚动视图,带有3个不同的视图控制器。一个蓝的,一个红的,还有一个绿的。
图标在应用程序打开的页面上看起来很好(蓝色):

然而,当我滑动到绿色或红色页面时,按钮似乎仍然是蓝色的,并且不像我希望的那样透明:


我怎样才能阻止它这样做呢?我只希望图标是透明的?
发布于 2013-12-11 05:50:46
UIButtonTypeInfoLight使用应用程序的色调颜色,默认为您看到的蓝色。你可以做的就是动态改变UIButton的色调:
[infoButton setTintColor:[UIColor redColor]];https://stackoverflow.com/questions/20505867
复制相似问题