jjzjj

backgroundColor

全部标签

ios - 使用 Swift3 为 iOS 中的 UIButton 设置 'backgroundColor' 动画

我想为我的UIButtons的backgroundColor属性设置动画,但我不确定从哪里开始。我从未使用过CoreAnimation,我什至不确定我是否需要它来做如此基本的事情?我使用一个类和一个看起来像这样的方法来设置按钮的样式:redTheme.swiftfuncmakeRedButton(){self.layer.backgroundColor=myCustomRedcolor} 最佳答案 您可以使用UIViewAnimation来实现,如下所示:注意:在执行动画之前不要忘记将背景设置为清除,否则将无法运行。那是因为动画需要

objective-c - iOS 中的动画背景

我想在我的iOS应用程序中加载View后为我的背景制作动画。这适用于纯色,但我无法让它使用背景图像。这是我的代码:-(void)viewDidLoad{[superviewDidLoad];[UIViewanimateWithDuration:5.0animations:^{self.view.backgroundColor=[[UIColoralloc]initWithPatternImage:[UIImageimageNamed:@"background.png"]];self.view.backgroundColor=[[UIColoralloc]initWithPatternI

ios - 设置 backgroundColor 似乎不适用于 UIView

我有一些代码试图通过图像在UIView中设置背景颜色,但我只看到黑屏。这是我所做的-有一个UIViewController类和一个UIView类UIView类有一个drawRect函数。在UIViewControllerviewDidLoad函数中创建UIView类之后UIView中的drawRect被调用。这是UIView的代码-(id)initWithFrame:(CGRect)frame{self=[superinitWithFrame:frame];if(self){//Initializationcode}returnself;}-(void)drawRect:(CGRect

objective-c - UIView 在 iOS 设备上不透明,但在模拟器上是透明的

有一个我想透明化的View,它可以在模拟器上运行,但由于某种原因不能在我的设备上运行。我不知道为什么会这样。我的代码如下所示:-(void)viewDidLoad[...]UIView*transparentBackgroundView=[[UIViewalloc]initWithFrame:self.view.frame];//Doesn'tworkonmydevice.transparentFlipBackgroundView.backgroundColor=[UIColorclearColor];//Ihavealsotried.//transparentFlipBackgrou

ios - 静态 UITableViewCell backgroundColor 在 iPad 上始终为白色

在我的项目中,我有一个静态TableView。我在界面生成器中更改了单元格的背景颜色。这在iPhone上正确显示。但是,在iPad上,单元格背景始终为白色。我找到了动态单元格的解决方案here,但由于它使用的是UITableViewDataSource协议(protocol),我不能将它用于我的静态表。我该如何解决这个问题? 最佳答案 正如@SandeepAggarwal所指出的,您应该设置cell.contentView.backgroundColor。 关于ios-静态UITable

ios - 如果我使用 clearColor 作为 backgroundColor,我需要将 UIVIew.opaque 显式设置为 NO 吗?

需要我写:view.opaque=NO;对于每个具有透明backgroundColor或小于1alpha的View?从文档看来是这样:Anopaqueviewisexpectedtofillitsboundswithentirelyopaquecontent—thatis,thecontentshouldhaveanalphavalueof1.0.Iftheviewisopaqueandeitherdoesnotfillitsboundsorcontainswhollyorpartiallytransparentcontent,theresultsareunpredictable.Yo

ios - 使用 accessoryView 为 UITableViewCell 的 backgroundColor 设置动画

目前,我正在研究UITableViewController。在其UITableView的单元格中,它显示来自Web服务的实时数据。当其中一个基础数据项更新时(每两分钟左右一次),我希望单元格短暂“闪烁”,以便用户理解,该单元格的数据刚刚更新。到目前为止,我使用了这段代码:[UIViewanimateWithDuration:0.2delay:0.0options:UIViewAnimationOptionAllowUserInteraction|UIViewAnimationOptionCurveEaseInOutanimations:^{cell.contentView.backgr

php - 从 MySQL 中提取数据到 json 数组

我正在尝试使用php中的json从我的数据库中提取数据。我需要指定一些元素,然后将它们发布到页面上。我想从mysql中“获取”数据并将其返回给json_encode。我如何使用SELECT方法执行此操作。有些人使用了PDO方法,而其他人使用了mysql_assoc,这让我很困惑。例如,我有以下行:'id'、'title'、'start'、'backgroundColor'...等。以及所有这些的默认值。($array[]="someValue=default")我希望它像这样导出:array('id'=>1,'title'=>"someTitle",'start'=>"2012-04-

ios - 使用全局 Tint 颜色作为 UINavigationBars backgroundColor

我需要将UINavigationBars背景颜色设置为与我的应用程序全局色调颜色相同的值。这里的问题是,现在我的导航栏中的所有按钮都与其背景颜色相同。我现在可以将所有UIBarButtons文本颜色更改为白色,但这将完全无法使用。使用UIAppearanceAPI似乎不是更好的方法。将UIBarButton项目的文本颜色设置为白色后,我的UINavigationBar中后退按钮的后退箭头仍然使用全局色调颜色绘制。此外,如果我将全局色调颜色更改为白色,我将失去全局色调颜色为我们提供的所有灵active(而且我的文本指示器现在将是白色,并且不会在白色背景上看到)我想要什么:我使用蓝色作为全

ios - 更改空 TableView 单元格的颜色?

我更改了Storyboard中单元格的颜色(未使用任何代码),但正如您在这张图片中所见:空单元格默认保持白色。我也想将那些空单元格更改为红色,但我无法弄清楚。我也在我的代码设置cell.backgroundColor=[UIColorredColor];没有成功。 最佳答案 您只需设置tableView的backgroundColor:yourTableView.backgroundColor=[UIColorredColor]; 关于ios-更改空TableView单元格的颜色?,我们