如何创建纹理背景(图像调色板)颜色,例如分组表格视图背景颜色?

发布于 2025-01-07 13:46:27 字数 566 浏览 3 评论 0原文

我想知道是否有人知道如何在调色板中设置新的纹理颜色。请参见下图。

background color

我尝试单击“其他...”,然后放置图像调色板。像这样:

在此处输入图像描述

所以现在我只能从中选择一个像素。我希望我可以选择更多。这将使工作变得更加容易,而不是每次都以编程方式设置背景。 如果您对我可以尝试的事情有任何建议,例如要覆盖的文件或任何内容,请帮助... 谢谢。

以编程方式有点简单。但我正在制作一个通用应用程序(iPhone 和 iPad)并且......好吧必须有一种解决方法。 这是我以编程方式执行此操作的方法:

UIImage *wood = [UIImage imageNamed:@"woodenBack.png"];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:wood];

I was wondering if anyone knows how to setup a new textured color in the palette. See the image below.

background colors

I tried to click on Other.... and then put a image palette on. like so:

enter image description here

So now I can select only one pixel out of it. I wish I could select more. It would make the work a lot easier instead of setting the background programatically every time.
If you have any suggestions of things I can try such as files to override or anything please help...
Thanks.

Programatically is kinda easy. But I'm making a universal app (iphone and Ipad) and... well there must be a way around it.
Here's how I do it programatically:

UIImage *wood = [UIImage imageNamed:@"woodenBack.png"];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:wood];

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

始于初秋 2025-01-14 13:46:27

可以使用类似的东西,

BOOL large = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); // Page thumb size

if(large){
UIImage *wood = [UIImage imageNamed:@"woodenBack.png"];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:wood];
}else{
UIImage *brick = [UIImage imageNamed:@"brick.png"];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:brick];
}

如果背景在所有视图中持续存在,那么您可以将背景应用到应用程序委托中的 UIWindow 并在其余视图中设置背景颜色清晰颜色。

另一种方法是循环并浏览子视图并查找表视图并将背景应用到表视图,但我想这是一个 CPU 密集型任务,最好使用代码加载图像。

Can use something like this,

BOOL large = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); // Page thumb size

if(large){
UIImage *wood = [UIImage imageNamed:@"woodenBack.png"];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:wood];
}else{
UIImage *brick = [UIImage imageNamed:@"brick.png"];
self.tableView.backgroundColor = [UIColor colorWithPatternImage:brick];
}

if the background persists across all views then you can possibly apply the background to the UIWindow in your appdelegate and set background color clear color in the rest of the views.

Another approach is to loop and browse through the subviews and find tableview and apply background to the tableview, but I guess this is a CPU intensive task and it is better to have image loaded using code.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文