object:setNativeProperty()

Type Function
Object NativeDisplayObject
Library native.*
Return value none
Revision 2017.3145
Keywords native object, property accessors
See also object:getNativeProperty()

Overview

This function allows you to set properties of the underlying native object created by the native library. For example, if you create a WebView on iOS, you can set the Obj-C properties of the corresponding UIWebView.

Gotchas

This is an iOS-only feature.

Syntax

object:setNativeProperty( property, value )
property (required)

String. The string name for the native property.

value (required)

The value to set the property to. Must be a Lua value compatible with Obj-C. The following Lua values are converted to the corresponding values in Obj-C: boolean, string, array, table, and number.

Example

local webView = native.newWebView( 0, 0, display.contentWidth, display.contentHeight )
webView:setNativeProperty( "allowsInlineMediaPlayback", true )