system.deactivate()

类型 函数
system.*
返回值
修订 版本 2024.3703
关键词 多点触控
另请参阅 system.activate()

概述

停用系统级功能,例如 `“multitouch”`。

默认情况下,多点触控功能是禁用的,因此除非之前通过 system.activate() 激活,否则此函数不会有任何效果。

语法

system.deactivate( feature )
feature (必需)

字符串 要停用的系统功能。目前,唯一支持的值包括:

示例

-- The following sample activates multitouch and creates a touch listener for a graphic
-- This displays the location, phase, and touch ID of each touch event
-- After 8 seconds, multitouch is then deactivated

system.activate( "multitouch" )
 
local bg = display.newRect( 0, 0, 320, 480 )
local output = native.newTextBox( 0, 20, 320, 240 )
output.size = 12
 
function showTouch( event )
    -- Display the event info on the screen
    output.text = output.text .. "\nPhase: " .. event.phase
    output.text = output.text .. "\n(" .. event.x .. "," .. event.y .. ")"
    output.text = output.text .. "\nId: " .. tostring( event.id )
end
 
bg:addEventListener( "touch", showTouch )
 
-- Deactivate multitouch after 8 seconds
timer.performWithDelay( 8000, function() system.deactivate( "multitouch" ); end )