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.
| Value | Position |
|---|---|
topRightCorner | Top-right (default) |
topLeftCorner | Top-left |
bottomRightCorner | Bottom-right |
bottomLeftCorner | Bottom-left |
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.preferredAdChoicesViewPosition = .topRightCorner
let nativeOption = GFPAdNativeOptions()
nativeOption.renderingSetting = renderingSetting
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.preferredAdChoicesViewPosition = GFPAdChoicesViewPositionTopRightCorner;
GFPAdNativeOptions *nativeOptions = [[GFPAdNativeOptions alloc] init];
nativeOptions.renderingSetting = renderingSetting;
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.
- Swift
- Objective-C
let renderingSetting = GFPNativeSimpleAdRenderingSetting()
renderingSetting.adAssetsPositionInFullAdView = true
GFPNativeSimpleAdRenderingSetting *renderingSetting = [[GFPNativeSimpleAdRenderingSetting alloc] init];
renderingSetting.adAssetsPositionInFullAdView = YES;
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).
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.adInterfaceStyle = .light
renderingSetting.adInterfaceStyle = .dark
renderingSetting.adInterfaceStyle = .system // Follows the device setting
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.adInterfaceStyle = GFPAdInterfaceStyleLight;
renderingSetting.adInterfaceStyle = GFPAdInterfaceStyleDark;
renderingSetting.adInterfaceStyle = GFPAdInterfaceStyleSystem;
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).
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.mediaRegularFont = UIFont.systemFont(ofSize: 14, weight: .regular)
renderingSetting.mediaBoldFont = UIFont.systemFont(ofSize: 14, weight: .bold)
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.mediaRegularFont = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
renderingSetting.mediaBoldFont = [UIFont systemFontOfSize:14 weight:UIFontWeightBold];
slotLoadingColor / slotLoadingDarkColor
The background color displayed while a carousel slot is loading. Default is nil.
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.slotLoadingColor = UIColor(white: 0.9, alpha: 1.0)
renderingSetting.slotLoadingDarkColor = UIColor(white: 0.2, alpha: 1.0)
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.slotLoadingColor = [UIColor colorWithWhite:0.9 alpha:1.0];
renderingSetting.slotLoadingDarkColor = [UIColor colorWithWhite:0.2 alpha:1.0];
slotPlaceHolderImage / slotPlaceHolderDarkImage
A placeholder image displayed before the carousel slot image finishes loading. Default is nil.
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.slotPlaceHolderImage = UIImage(named: "placeholder")
renderingSetting.slotPlaceHolderDarkImage = UIImage(named: "placeholder_dark")
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.slotPlaceHolderImage = [UIImage imageNamed:@"placeholder"];
renderingSetting.slotPlaceHolderDarkImage = [UIImage imageNamed:@"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.
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.useMediaDimmed = true
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.useMediaDimmed = YES;
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).
- Swift
- Objective-C
let obstruction = GFPOMFriendlyObstruction(view: myOverlayView,
purpose: .notVisible,
detailedReason: "service overlay")
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.omFriendlyObstructions = [obstruction]
GFPOMFriendlyObstruction *obstruction =
[[GFPOMFriendlyObstruction alloc] initWithView:myOverlayView
purpose:GFPOMFriendlyObstructionPurposeNotVisible
detailedReason:@"service overlay"];
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
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.
- Swift
- Objective-C
let renderingSetting = GFPNativeSimpleAdRenderingSetting()
renderingSetting.isImageSizePreferred = true
GFPNativeSimpleAdRenderingSetting *renderingSetting = [[GFPNativeSimpleAdRenderingSetting alloc] init];
renderingSetting.isImageSizePreferred = YES;
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.
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.viewWidth = NSNumber(value: UIScreen.main.bounds.width)
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.viewWidth = @(UIScreen.mainScreen.bounds.size.width);
NN-Specific Options (GFPNativeAdRenderingSetting)
Set via GFPAdNativeOptions.renderingSetting.
hasMediaView
Sets whether the native view includes a MediaView. Default is YES.
A rendering error will occur if this value does not match the actual presence of a MediaView in the native view.
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.hasMediaView = false
let nativeOption = GFPAdNativeOptions()
nativeOption.renderingSetting = renderingSetting
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.hasMediaView = NO;
GFPAdNativeOptions *nativeOptions = [[GFPAdNativeOptions alloc] init];
nativeOptions.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.
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.
- Swift
- Objective-C
let renderingSetting = GFPNativeAdRenderingSetting()
renderingSetting.useInternalCache = true
let nativeOption = GFPAdNativeOptions()
nativeOption.renderingSetting = renderingSetting
GFPNativeAdRenderingSetting *renderingSetting = [[GFPNativeAdRenderingSetting alloc] init];
renderingSetting.useInternalCache = YES;
GFPAdNativeOptions *nativeOption = [[GFPAdNativeOptions alloc] init];
nativeOption.renderingSetting = renderingSetting;
NS-Specific Options (GFPNativeSimpleAdRenderingSetting)
Set via GFPAdNativeSimpleOptions.simpleAdRenderingSetting.
videoEventDelegate
A delegate that receives video player events for NS rich-type ads.
- Swift
- Objective-C
let renderingSetting = GFPNativeSimpleAdRenderingSetting()
renderingSetting.videoEventDelegate = self // Must implement GFPNativeVideoEventDelegate
GFPNativeSimpleAdRenderingSetting *renderingSetting = [[GFPNativeSimpleAdRenderingSetting alloc] init];
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.
0or 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
| Option | Scope | Default | Notes |
|---|---|---|---|
preferredAdChoicesViewPosition | Common | topRightCorner | |
adAssetsPositionInFullAdView | Common | NO | s2s only |
adInterfaceStyle | Common | system | Naver ads only |
enableCustomAdChoices | Common | NO | s2s only |
richMediaInsets | Common | UIEdgeInsetsZero | Carousel only |
mediaRegularFont | Common | nil | Carousel only |
mediaBoldFont | Common | nil | Carousel only |
slotLoadingColor | Common | nil | Carousel only |
slotLoadingDarkColor | Common | nil | Carousel only |
slotPlaceHolderImage | Common | nil | Carousel only |
slotPlaceHolderDarkImage | Common | nil | Carousel only |
useMediaDimmed | Common | NO | |
omFriendlyObstructions | Common | nil | s2s: all applied / LAN: view only |
useLazyMediaLoading | Common | NO | |
isImageSizePreferred | Common | NO | |
viewWidth | Common | nil | For ads sized by horizontal resolution (e.g., carousel) |
hasMediaView | NN only | YES | |
enableMediaBackgroundBlur | NN only | NO | |
useInternalCache | NN only | NO | |
videoEventDelegate | NS only | - | |
maxExtendingHeight | NS only | -1 | |
backgroundOption | NS only | nil | |
adChoicesPositionInFullAdView | Common | NO | deprecated → adAssetsPositionInFullAdView |