Class PTPopupWebViewStyle

April 1, 2016 · View on GitHub

PTPopupWebViewStyle is view style settings for PTPopupWebView.

To customize the style, you choose one of below way.

  1. generate a PTPopupWebViewStyle instance and change the parameters.
  2. define the Style class extends PTPopupWebViewStyle, and change the parameters in initializer.

Usage

Generate a PTPopupWebViewStyle instance and change the parameters,

let style = PTPopupWebViewStyle()
    .titleBackgroundColor(.darkGrayColor())
    .titleForegroundColor(.whiteColor())

or define the Style class extends PTPopupWebViewStyle, and change the parameters in initializer as below.

public class MyStyle : PTPopupWebViewStyle {
    override public init(){
        super.init()
        
        titleBackgroundColor = .darkGrayColor()
        titleForegroundColor = .whiteColor()
    }
}

Property

All properties are able to set by method chain propertyName().

Content view's property

PropertyDescrptionDefault
outerMarginSpacing between frame and content view.UIEdgeInsetsZero
innerMarginSpacing between content view and web view.UIEdgeInsetsZero
backgroundColorContent view's background color.UIColor.whiteColor()
cornerRadiusContent view's corner radius.8.0

Title area's property

PropertyDescrptionDefault
titleHeightTitle area's height.40.0
titleHiddenTitle area's invisibility.false
titleBackgroundColorTitle area's background color.UIColor.clearColor()
titleForegroundColorTitle area's foreground color.UIColor.darkGrayColor()
titleFontTitle's font.UIFont.systemFontOfSize(16)

Button area's property

PropertyDescrptionDefault
buttonHeightButton area's height.40
buttonHiddenButton area's invisibility.false
buttonBackgroundColorButton's default background color. UIColor.clearColor()
buttonForegroundColorButton's default foreground color. green color
buttonDisabledColorButton's default foreground color when button is disabled. UIColor.lightGrayColor()
buttonFontButton's font. UIFont.systemFontOfSize(16)
buttonDistributionButton's distribution. .Equal, all buttons have equal width, .Proportional, adjust the width the contents of the button..Equal

※ These settings can be overridden by the button indivisual settings.

Other property

PropertyDescrptionDefault
closeButtonHiddenClose button's invisibility (positioned at right top of view).true