{"id":271770,"date":"2016-01-08T13:27:02","date_gmt":"2016-01-08T10:27:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=271770"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=271770","title":{"rendered":"\u041c\u0430\u0433\u0438\u044f IBDesignable \u0438\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c Interface Builder \u0432 Xcode"},"content":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/193\/2de\/56f\/1932de56faf84c8290b56e28940f0a50.png\"\/><\/p>\n<p>  Interface Builder \u0432 Xcode \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u043c\u043d\u0435 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c\u0443 \u043b\u0430\u0439\u0430\u0443\u0442\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0421 \u0432\u0435\u0440\u0441\u0438\u0438 6 \u0432 Xcode \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0432\u044c\u044e\u0448\u0435\u043a, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c IBDesignable, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0431\u0438\u043b\u0434\u0435\u0440\u0435 \u043f\u043e\u043b\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c IBInspectable.<\/p>\n<p>  \u0421 \u0432\u0435\u0440\u0441\u0438\u0438 Xcode 7 \u044d\u0442\u043e\u0439 \u0444\u0438\u0447\u0435\u0439 \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0451 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e IBDesignable\/IBInspectable \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/developer.apple.com\/library\/ios\/recipes\/xcode_help-IB_objects_media\/Chapters\/CreatingaLiveViewofaCustomObject.html\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"http:\/\/nshipster.com\/ibinspectable-ibdesignable\/\">\u0442\u0443\u0442<\/a>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u0435\u0439\u0441<\/h4>\n<p>  \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u0443\u044e \u043a\u043d\u043e\u043f\u043a\u0443 \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0446\u0432\u0435\u0442, \u0442\u043e\u043b\u0449\u0438\u043d\u0443 \u0438 \u0440\u0430\u0434\u0438\u0443\u0441 \u0441\u043a\u0440\u0443\u0433\u043b\u0435\u043d\u0438\u044f border, \u043f\u0440\u0438\u0447\u0435\u043c \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u044d\u0442\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Interface Builder.<\/p>\n<pre><code>@IBDesignable class BorderedButton : UIButton {     \/\/\/ \u0422\u043e\u043b\u0449\u0438\u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var borderWidth: CGFloat {         set { layer.borderWidth = newValue }         get { return layer.borderWidth }     }     \/\/\/ \u0426\u0432\u0435\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var borderColor: UIColor? {         set { layer.borderColor = newValue?.CGColor }         get { return layer.borderColor?.UIColor }     }     \/\/\/ \u0420\u0430\u0434\u0438\u0443\u0441 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var cornerRadius: CGFloat {         set { layer.cornerRadius = newValue }         get { return layer.cornerRadius  }     } }  extension CGColor {     private var UIColor: UIKit.UIColor {         return UIKit.UIColor(CGColor: self)     } } <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8da\/65a\/8b5\/8da65a8b53b047d9b10293db23db50ee.png\"\/><\/p>\n<p>  \u0412\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u0431\u0438\u043b\u0434\u0435\u0440 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u043d\u0434\u0435\u0440 \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b05\/046\/ebc\/b05046ebcf8c410089927a31eaa831f0.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/fef\/f63\/500\/feff635002254fcf823c0a22efc4e1c3.png\"\/><\/p>\n<p>  \u041d\u043e \u0432\u0435\u0434\u044c \u0442\u0430\u043a\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0443 \u043d\u0430\u0448\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u043d\u043e\u043f\u043a\u0438, \u0430 \u0443 \u043b\u044e\u0431\u044b\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043a\u043d\u043e\u043f\u043e\u043a. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 UIButton.<\/p>\n<pre><code>extension UIButton {     \/\/\/ \u0420\u0430\u0434\u0438\u0443\u0441 \u0433\u0430\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var cornerRadius: CGFloat {         set { layer.cornerRadius = newValue  }         get { return layer.cornerRadius }     }     \/\/\/ \u0422\u043e\u043b\u0449\u0438\u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var borderWidth: CGFloat {         set { layer.borderWidth = newValue }         get { return layer.borderWidth }     }     \/\/\/ \u0426\u0432\u0435\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var borderColor: UIColor? {         set { layer.borderColor = newValue?.CGColor  }         get { return layer.borderColor?.UIColor }     } } <\/code><\/pre>\n<p>  \u0421\u043e\u0442\u0440\u0451\u043c IBInspectable \u043f\u043e\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u0438, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u0443\u0436\u0435 \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0438. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a\u043b\u0430\u0441\u0441 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u044b\u043c.<\/p>\n<pre><code>@IBDesignable class BorderedButton : UIButton {} <\/code><\/pre>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u0443 \u043a\u043d\u043e\u043f\u043a\u0443 \u0440\u044f\u0434\u043e\u043c \u0441 \u043d\u0430\u0448\u0435\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0439 \u043a\u043d\u043e\u043f\u043a\u043e\u0439, \u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u043d\u0430\u0447\u0430\u0442\u044c \u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u0430 (\u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 UIButton). <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/838\/22b\/fbc\/83822bfbc59a4963bf8eb7b194f588f2.png\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, Interface Builder \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0432\u0432\u043e\u0434\u0430 IBInspectable \u043f\u043e\u043b\u0435\u0439 \u0434\u0430\u0436\u0435 \u0443 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 UIButton, \u043e\u0434\u043d\u0430\u043a\u043e \u043d\u0435 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u0442 \u0435\u0433\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c IBDesignable.<\/p>\n<h4>\u0420\u0430\u0441\u0448\u0438\u0440\u044f\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435<\/h4>\n<p>  \u041f\u043e\u0445\u043e\u0436\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 UIView.<\/p>\n<pre><code>extension UIView {         \/\/\/ \u0420\u0430\u0434\u0438\u0443\u0441 \u0433\u0430\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var cornerRadius: CGFloat {         set { layer.cornerRadius = newValue  }         get { return layer.cornerRadius }     }     \/\/\/ \u0422\u043e\u043b\u0449\u0438\u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var borderWidth: CGFloat {         set { layer.borderWidth = newValue }         get { return layer.borderWidth }     }     \/\/\/ \u0426\u0432\u0435\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     @IBInspectable var borderColor: UIColor? {         set { layer.borderColor = newValue?.CGColor  }         get { return layer.borderColor?.UIColor }     }     \/\/\/ \u0421\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0442\u0435\u043d\u0438     @IBInspectable var shadowOffset: CGSize {         set { layer.shadowOffset = newValue  }         get { return layer.shadowOffset }     }     \/\/\/ \u041f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u044c \u0442\u0435\u043d\u0438     @IBInspectable var shadowOpacity: Float {         set { layer.shadowOpacity = newValue }         get { return layer.shadowOpacity }     }     \/\/\/ \u0420\u0430\u0434\u0438\u0443\u0441 \u0431\u043b\u0443\u0440\u0430 \u0442\u0435\u043d\u0438     @IBInspectable var shadowRadius: CGFloat {         set {  layer.shadowRadius = newValue }         get { return layer.shadowRadius }     }     \/\/\/ \u0426\u0432\u0435\u0442 \u0442\u0435\u043d\u0438     @IBInspectable var shadowColor: UIColor? {         set { layer.shadowColor = newValue?.CGColor }         get { return layer.shadowColor?.UIColor }     }     \/\/\/ \u041e\u0442\u0441\u0435\u043a\u0430\u043d\u0438\u0435 \u043f\u043e \u0433\u0440\u0430\u043d\u0438\u0446\u0435     @IBInspectable var _clipsToBounds: Bool {         set { clipsToBounds = newValue }         get { return clipsToBounds }     } } <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/003\/9f2\/88b\/0039f288b3b14625ac2717c6688497b7.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u0441\u043b\u043e\u044f \u043b\u044e\u0431\u043e\u0439 \u0432\u044c\u044e\u0448\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0431\u0438\u043b\u0434\u0435\u0440. \u0414\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 live-\u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u2014 \u0443 \u0432\u044c\u044e\u0448\u043a\u0438 \u0432 \u0431\u0438\u043b\u0434\u0435\u0440\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441 \u0441 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c IBDesignable.<\/p>\n<h4>\u041d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043a\u0435\u0439\u0441<\/h4>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0443 \u043d\u0430\u0441 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0435\u0441\u0442\u044c \u0441\u0432\u0435\u0442\u043b\u0430\u044f \u0438 \u0442\u0435\u043c\u043d\u0430\u044f \u0442\u0435\u043c\u044b. \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0442\u0438\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043d\u043e\u043f\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f.<\/p>\n<pre><code>\/\/\/ \u0421\u0442\u0438\u043b\u044c \u043a\u043d\u043e\u043f\u043a\u0438 enum ButtonStyle: String {          \/\/\/ \u0421\u0432\u0435\u0442\u043b\u044b\u0439 \u0441\u0442\u0438\u043b\u044c     case Light  = &quot;light&quot;     \/\/\/ \u0422\u0435\u043c\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c     case Dark   = &quot;dark&quot;          \/\/\/ \u041e\u0442\u0442\u0435\u043d\u043e\u043a     var tintColor: UIColor {         switch self {         case .Light:    return UIColor.blackColor()         case .Dark:     return UIColor.lightGrayColor()         }     }     \/\/\/ \u0426\u0432\u0435\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     var borderColor:        UIColor { return tintColor }     \/\/\/ \u0426\u0432\u0435\u0442 \u0444\u043e\u043d\u0430     var backgroundColor:    UIColor { return UIColor.clearColor() }     \/\/\/ \u0422\u043e\u043b\u0449\u0438\u043d\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     var borderWidth:        CGFloat { return 1 }     \/\/\/ \u0420\u0430\u0434\u0438\u0443\u0441 \u0433\u0440\u0430\u043d\u0438\u0446\u044b     var cornerRadius:       CGFloat { return 4 } } <\/code><\/pre>\n<p>  \u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043a\u043b\u0430\u0441\u0441\u0430 UIButton, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0438\u043b\u0438 \u043a \u043a\u043d\u043e\u043f\u043a\u0430\u043c:<\/p>\n<pre><code>extension UIButton {      \/\/\/ \u0421\u0442\u0438\u043b\u044c \u043a\u043d\u043e\u043f\u043a\u0438     @IBInspectable var style: String? {         set { setupWithStyleNamed(newValue) }         get { return nil }     }     \/\/\/ \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0438\u043b\u044f \u043f\u043e \u0435\u0433\u043e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u043c\u0443 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e     private func setupWithStyleNamed(named: String?){         if let styleName = named, style = ButtonStyle(rawValue: styleName) {             setupWithStyle(style)         }     }     \/\/\/ \u041f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0442\u0438\u043b\u044f \u043f\u043e \u0435\u0433\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443     func setupWithStyle(style: ButtonStyle){         backgroundColor = style.backgroundColor         tintColor       = style.tintColor         borderColor     = style.borderColor         borderWidth     = style.borderWidth         cornerRadius    = style.cornerRadius     } } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0430 \u0431\u0438\u043b\u0434\u0435\u0440\u0435 \u0435\u0449\u0435 \u0434\u0432\u0435 \u043a\u043d\u043e\u043f\u043a\u0438, \u0438 \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u043e\u043b\u0435 Style \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0441\u0442\u0438\u043b\u0438 \u00abdark\u00bb \u0438 \u00ablight\u00bb \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e0c\/b83\/e77\/e0cb83e776114ba28d438308f35714a1.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/0c8\/7a8\/914\/0c87a891458a4b028c8287d56629135a.png\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/634\/a0a\/158\/634a0a158f4940ccaea71da0f7a8576e.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0438\u043b\u0438 \u043a \u043a\u043d\u043e\u043f\u043a\u0430\u043c \u043e\u0434\u043d\u0438\u043c \u043f\u043e\u043b\u0435\u043c \u0432 \u0431\u0438\u043b\u0434\u0435\u0440\u0435 \u0438 \u043d\u0430\u0431\u043b\u044e\u0434\u0430\u0442\u044c \u0438\u0445 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u0415\u0441\u043b\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u043c, \u0442\u043e \u043d\u0430\u043c \u0434\u0430\u0436\u0435 \u043d\u0435 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0439 IBDesignable \u043a\u043b\u0430\u0441\u0441 (\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u0441\u0443\u0442\u0438 \u043f\u0443\u0441\u0442\u043e\u0439). \u041d\u0438\u0447\u0442\u043e \u043d\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0438\u043b\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0442\u0438\u043f \u0441\u0442\u0438\u043b\u044f \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0432\u044b\u0431\u043e\u0440 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 \u0432\u044c\u044e\u0448\u043a\u0438.<\/p>\n<h4>\u0420\u0435\u0437\u044e\u043c\u0435<\/h4>\n<p>  \u0412 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043d\u0435 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043f\u0440\u0435\u043f\u043e\u0434\u043d\u0435\u0441\u0442\u0438 \u043d\u043e\u0432\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430. \u041e\u0434\u043d\u0430\u043a\u043e, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0434\u0442\u043e\u043b\u043a\u043d\u0435\u0442 \u043a\u043e\u0433\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430 \u0434\u0440\u0443\u0433\u043e\u0435 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0438\u0447\u0438.<\/p>\n<p>  \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/danteteam\/InterfaceBuilderExtension\">\u0433\u0438\u0442\u0435<\/a>.       <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/274687\/\"> http:\/\/habrahabr.ru\/post\/274687\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/193\/2de\/56f\/1932de56faf84c8290b56e28940f0a50.png\"\/><\/p>\n<p>  Interface Builder \u0432 Xcode \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u043c\u043d\u0435 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432 \u0440\u0430\u0431\u043e\u0442\u0435 \u043f\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u043c\u0443 \u043b\u0430\u0439\u0430\u0443\u0442\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0432 \u0437\u0430\u0434\u0430\u0447\u0435 \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u0421 \u0432\u0435\u0440\u0441\u0438\u0438 6 \u0432 Xcode \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u043d\u0434\u0435\u0440\u0430 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0445 \u0432\u044c\u044e\u0448\u0435\u043a, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c IBDesignable, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u0431\u0438\u043b\u0434\u0435\u0440\u0435 \u043f\u043e\u043b\u0435\u0439 \u043a\u043b\u0430\u0441\u0441\u0430, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0445 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c IBInspectable.<\/p>\n<p>  \u0421 \u0432\u0435\u0440\u0441\u0438\u0438 Xcode 7 \u044d\u0442\u043e\u0439 \u0444\u0438\u0447\u0435\u0439 \u0441\u0442\u0430\u043b\u043e \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0435\u0451 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u041f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u043e IBDesignable\/IBInspectable \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/developer.apple.com\/library\/ios\/recipes\/xcode_help-IB_objects_media\/Chapters\/CreatingaLiveViewofaCustomObject.html\">\u0442\u0443\u0442<\/a> \u0438 <a href=\"http:\/\/nshipster.com\/ibinspectable-ibdesignable\/\">\u0442\u0443\u0442<\/a>.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-271770","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/271770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=271770"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/271770\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=271770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=271770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=271770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}