<i id='qBCa7'><tr id='qBCa7'><dt id='qBCa7'><q id='qBCa7'><span id='qBCa7'><b id='qBCa7'><form id='qBCa7'><ins id='qBCa7'></ins><ul id='qBCa7'></ul><sub id='qBCa7'></sub></form><legend id='qBCa7'></legend><bdo id='qBCa7'><pre id='qBCa7'><center id='qBCa7'></center></pre></bdo></b><th id='qBCa7'></th></span></q></dt></tr></i><div id='qBCa7'><tfoot id='qBCa7'></tfoot><dl id='qBCa7'><fieldset id='qBCa7'></fieldset></dl></div>
    <bdo id='qBCa7'></bdo><ul id='qBCa7'></ul>

    1. <small id='qBCa7'></small><noframes id='qBCa7'>

      <legend id='qBCa7'><style id='qBCa7'><dir id='qBCa7'><q id='qBCa7'></q></dir></style></legend>
      1. <tfoot id='qBCa7'></tfoot>
      2. 如何“级联"UIImageView 中的图像模式?

        时间:2024-04-14
        <legend id='6m7TD'><style id='6m7TD'><dir id='6m7TD'><q id='6m7TD'></q></dir></style></legend>
          <tbody id='6m7TD'></tbody>

          <small id='6m7TD'></small><noframes id='6m7TD'>

          • <bdo id='6m7TD'></bdo><ul id='6m7TD'></ul>
            <tfoot id='6m7TD'></tfoot>
          • <i id='6m7TD'><tr id='6m7TD'><dt id='6m7TD'><q id='6m7TD'><span id='6m7TD'><b id='6m7TD'><form id='6m7TD'><ins id='6m7TD'></ins><ul id='6m7TD'></ul><sub id='6m7TD'></sub></form><legend id='6m7TD'></legend><bdo id='6m7TD'><pre id='6m7TD'><center id='6m7TD'></center></pre></bdo></b><th id='6m7TD'></th></span></q></dt></tr></i><div id='6m7TD'><tfoot id='6m7TD'></tfoot><dl id='6m7TD'><fieldset id='6m7TD'></fieldset></dl></div>

                • 本文介绍了如何“级联"UIImageView 中的图像模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个想要在 UIImageView 中显示的图像模式.UIImageVIew 的大小由用户输入的文本决定,因此它的高度会发生变化.有没有办法级联"图像模式,以便它会重复 UIImageView 的整个高度?理论上,我可以在 Photoshop 中构建一个超高的图像,并希望图像视图不会超过某个点,但我知道拥有一个基本模式并重复它是实现它的聪明方法.但是,我在 Interface Builder 中找不到与此相关的任何内容.这可能吗,如果可以,我该如何实现?

                  I have an image pattern which I want to display in a UIImageView. The UIImageVIew's size is determined by user-entered text, so its height will change. Is there a way to "cascade" the image pattern, so that it will repeat down the entire height of the UIImageView? In theory I could build a super-tall image in Photoshop, and hope that the image view doesn't get extended past a certain point, but I know that having a basic pattern and repeating it is the smart way to do it. However, I can't find anything related to this in Interface Builder. Is this possible to do, and if so, how can I accomplish it?

                  推荐答案

                  你应该可以用一个普通的 UIView 来完成这个.从图像创建一个 UIColor(这会生成一个图案图像",可以平铺:

                  You should be able to accomplish this with a plain UIView. Create a UIColor from the image (this makes a "pattern image", which can be tiled:

                  UIColor *patternColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"pattern"]];
                  

                  然后像这样设置视图的背景颜色:

                  Then set the background color of the view like so:

                  view.backgroundColor = patternColor;
                  

                  我会在视图控制器的 viewDidLoadviewWillAppear 方法中运行此代码.

                  I'd run this code in the viewDidLoad or viewWillAppear methods of the view's controller.

                  这篇关于如何“级联"UIImageView 中的图像模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:以编程方式更改 UIImageView Xcode Swift 的高度和宽度 下一篇:创建 UIImageView 时上下文无效

                  相关文章

                    <small id='fG1d4'></small><noframes id='fG1d4'>

                    <i id='fG1d4'><tr id='fG1d4'><dt id='fG1d4'><q id='fG1d4'><span id='fG1d4'><b id='fG1d4'><form id='fG1d4'><ins id='fG1d4'></ins><ul id='fG1d4'></ul><sub id='fG1d4'></sub></form><legend id='fG1d4'></legend><bdo id='fG1d4'><pre id='fG1d4'><center id='fG1d4'></center></pre></bdo></b><th id='fG1d4'></th></span></q></dt></tr></i><div id='fG1d4'><tfoot id='fG1d4'></tfoot><dl id='fG1d4'><fieldset id='fG1d4'></fieldset></dl></div>

                    1. <legend id='fG1d4'><style id='fG1d4'><dir id='fG1d4'><q id='fG1d4'></q></dir></style></legend>

                      • <bdo id='fG1d4'></bdo><ul id='fG1d4'></ul>
                    2. <tfoot id='fG1d4'></tfoot>