Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Rich86Man's answer is correct, but you can use categories to proxy properties such as layer.borderColor. (From the <a href="https://github.com/ConventionalC/ConventionalC/blob/develop/ios/CALayer+XibConfiguration.h" rel="noreferrer">ConventionalC</a> CocoaPod)</p> <p><strong>CALayer+XibConfiguration.h:</strong></p> <pre><code>#import &lt;QuartzCore/QuartzCore.h&gt; #import &lt;UIKit/UIKit.h&gt; @interface CALayer(XibConfiguration) // This assigns a CGColor to borderColor. @property(nonatomic, assign) UIColor* borderUIColor; @end </code></pre> <p><strong>CALayer+XibConfiguration.m:</strong></p> <pre><code>#import "CALayer+XibConfiguration.h" @implementation CALayer(XibConfiguration) -(void)setBorderUIColor:(UIColor*)color { self.borderColor = color.CGColor; } -(UIColor*)borderUIColor { return [UIColor colorWithCGColor:self.borderColor]; } @end </code></pre> <p><img src="https://i.stack.imgur.com/ZSbPt.png" alt="Interface Builder"></p> <pre><code>layer.borderUIColor </code></pre> <p>The result will be apparent during runtime, not in Xcode.</p> <p><strong>Edit</strong>: You also need to set <code>layer.borderWidth</code> to at least 1 to see the border with the chosen color.</p> <p><strong><em>In Swift 2.0:</em></strong></p> <pre><code>extension CALayer { var borderUIColor: UIColor { set { self.borderColor = newValue.CGColor } get { return UIColor(CGColor: self.borderColor!) } } } </code></pre> <p><strong><em>In Swift 3.0:</em></strong></p> <pre><code>extension CALayer { var borderUIColor: UIColor { set { self.borderColor = newValue.cgColor } get { return UIColor(cgColor: self.borderColor!) } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload