Skip to main content

Native Rendering Options

This is a reference summarizing all options for GFPNativeAdRenderingSetting (NN) and GFPNativeSimpleAdRenderingSetting (NS).

Class Hierarchy

GFPNativeBaseRenderingSetting ← Options common to NN / NS
├── GFPNativeAdRenderingSetting (additional NN-specific options)
└── GFPNativeSimpleAdRenderingSetting (additional NS-specific options)

Common Options (GFPNativeBaseRenderingSetting)

Available in both NN (GFPAdNativeOptions.renderingSetting) and NS (GFPAdNativeSimpleOptions.simpleAdRenderingSetting).

preferredAdChoicesViewPosition

Sets the position where the DFP adChoicesView is inserted as an overlay. The default is top-right.

ValuePosition
topRightCornerTop-right (default)
topLeftCornerTop-left
bottomRightCornerBottom-right
bottomLeftCornerBottom-left
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.preferredAdChoicesViewPosition = .topRightCorner

let nativeOption = GFPAdNativeOptions()
nativeOption.renderingSetting = renderingSetting
info

Google's documentation states that if you register an adChoicesView directly, it will be rendered in that registered view rather than as an overlay — however, this does not currently work as expected. This setting is required if you want the adChoicesView rendered in a position other than the top-right.

For custom AdChoices implementation, see Custom AdChoices.


adAssetsPositionInFullAdView

Sets the position reference for ad assets such as the adChoicesView to the full ad view rather than the media area. Applies to s2s ads only. Default is NO.

let renderingSetting = GFPNativeSimpleAdRenderingSetting()
renderingSetting.adAssetsPositionInFullAdView = true
caution

adChoicesPositionInFullAdView is deprecated. Please use adAssetsPositionInFullAdView instead.


adInterfaceStyle

Sets the ad UI style, including the adChoicesView color and rich media background color. Only applies to Naver ads. Takes precedence over the global setting (GFPAdConfiguration.adInterfaceStyle).

let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.adInterfaceStyle = .light
renderingSetting.adInterfaceStyle = .dark
renderingSetting.adInterfaceStyle = .system // Follows the device setting

enableCustomAdChoices

Disables the SDK's default adChoicesView rendering when implementing a custom adChoicesView. Applies to s2s ads only. Default is NO.

For more details, see Custom AdChoices.


richMediaInsets

Sets the left and right margins of the carousel ad UICollectionView. Default is UIEdgeInsetsZero.

For more details, see Native Carousel Ads.


mediaRegularFont / mediaBoldFont

Customizes the fonts used inside the carousel ad MediaView. Default is nil (system font).

let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.mediaRegularFont = UIFont.systemFont(ofSize: 14, weight: .regular)
renderingSetting.mediaBoldFont = UIFont.systemFont(ofSize: 14, weight: .bold)

slotLoadingColor / slotLoadingDarkColor

The background color displayed while a carousel slot is loading. Default is nil.

let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.slotLoadingColor = UIColor(white: 0.9, alpha: 1.0)
renderingSetting.slotLoadingDarkColor = UIColor(white: 0.2, alpha: 1.0)

slotPlaceHolderImage / slotPlaceHolderDarkImage

A placeholder image displayed before the carousel slot image finishes loading. Default is nil.

let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.slotPlaceHolderImage = UIImage(named: "placeholder")
renderingSetting.slotPlaceHolderDarkImage = UIImage(named: "placeholder_dark")

useMediaDimmed

Applies a dim effect to the ad MediaView. When enabled, a 2% dim is applied to standard ads and an 8% dim to outstream video ads. Default is NO.

let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.useMediaDimmed = true

omFriendlyObstructions

Sets a list of views to register as friendlyObstructions during OMSDK measurement. For s2s ads, register service UI elements that appear on top of the ad (e.g., play buttons, labels) to improve measurement accuracy. Not applied to c2s (LAN passes view only).

let obstruction = GFPOMFriendlyObstruction(view: myOverlayView,
purpose: .notVisible,
detailedReason: "service overlay")
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.omFriendlyObstructions = [obstruction]

useLazyMediaLoading

Loads media (images, icons, etc.) asynchronously with deferred loading. Default is NO.

For more details, see Native Ad Options or Native Simple Ad Options.


isImageSizePreferred

Prioritizes image size over the ad area when laying out the ad. When enabled, the image size takes priority over the configured ad area and is positioned at the bottom. Default is NO.

let renderingSetting = GFPNativeSimpleAdRenderingSetting()
renderingSetting.isImageSizePreferred = true

viewWidth

Explicitly specifies the width of the view in which the ad will be rendered, for ad types (e.g., carousel) whose cell size is determined based on the horizontal resolution.

let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.viewWidth = NSNumber(value: UIScreen.main.bounds.width)

NN-Specific Options (GFPNativeAdRenderingSetting)

Set via GFPAdNativeOptions.renderingSetting.

hasMediaView

Sets whether the native view includes a MediaView. Default is YES.

danger

A rendering error will occur if this value does not match the actual presence of a MediaView in the native view.

let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.hasMediaView = false

let nativeOption = GFPAdNativeOptions()
nativeOption.renderingSetting = renderingSetting

enableMediaBackgroundBlur

Applies a blur effect to the margins of the native ad MediaView. Default is NO.

For more details, see Native Video Ads.


useInternalCache

Uses an internal cache to improve native ad rendering performance. Default is NO.

info

This is a rendering-only cache that operates independently from the ad caching feature (NAMSDK 8.17.0). For ad object caching, see Ad Cache.

let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.useInternalCache = true

let nativeOption = GFPAdNativeOptions()
nativeOption.renderingSetting = renderingSetting

NS-Specific Options (GFPNativeSimpleAdRenderingSetting)

Set via GFPAdNativeSimpleOptions.simpleAdRenderingSetting.

videoEventDelegate

A delegate that receives video player events for NS rich-type ads.

let renderingSetting = GFPNativeSimpleAdRenderingSetting()
renderingSetting.videoEventDelegate = self // Must implement GFPNativeVideoEventDelegate

maxExtendingHeight

Limits the maximum expansion height for expandable rich ads. Can be changed dynamically even after the ad has loaded.

  • 0 or less: No height limit (default: -1)
  • Greater than 0: Height is limited to that value

For more details, see Native Simple Rich Ads.


backgroundOption

Sets a custom background style to apply when the ad response contains no background information.

For more details, see Native Simple Ad Options.


Quick Reference for All Options

OptionScopeDefaultNotes
preferredAdChoicesViewPositionCommontopRightCorner
adAssetsPositionInFullAdViewCommonNOs2s only
adInterfaceStyleCommonsystemNaver ads only
enableCustomAdChoicesCommonNOs2s only
richMediaInsetsCommonUIEdgeInsetsZeroCarousel only
mediaRegularFontCommonnilCarousel only
mediaBoldFontCommonnilCarousel only
slotLoadingColorCommonnilCarousel only
slotLoadingDarkColorCommonnilCarousel only
slotPlaceHolderImageCommonnilCarousel only
slotPlaceHolderDarkImageCommonnilCarousel only
useMediaDimmedCommonNO
omFriendlyObstructionsCommonnils2s: all applied / LAN: view only
useLazyMediaLoadingCommonNO
isImageSizePreferredCommonNO
viewWidthCommonnilFor ads sized by horizontal resolution (e.g., carousel)
hasMediaViewNN onlyYES
enableMediaBackgroundBlurNN onlyNO
useInternalCacheNN onlyNO
videoEventDelegateNS only-
maxExtendingHeightNS only-1
backgroundOptionNS onlynil
adChoicesPositionInFullAdViewCommonNOdeprecated → adAssetsPositionInFullAdView