quick3 进入后台返回前台不触发消息
quick3中framework/cc/mvc/AppBase中注册前后台函数,跟踪注册成功
local eventDispatcher = cc.Director:getInstance():getEventDispatcher()
local customListenerBg = cc.EventListenerCustom:create(cc.EVENT_COME_TO_BACKGROUND,
handler(self, self.onEnterBackground))
eventDispatcher:addEventListenerWithFixedPriority(customListenerBg, 1)
local customListenerFg = cc.EventListenerCustom:create(cc.EVENT_COME_TO_FOREGROUND,
handler(self, self.onEnterForeground))
eventDispatcher:addEventListenerWithFixedPriority(customListenerFg, 1)
但是lua中注册的函数却没有被调用
function AppBase:onEnterBackground()
printInfo(“AppBase:onEnterBackground()…”)
self:dispatchEvent({name = AppBase.APP_ENTER_BACKGROUND_EVENT})
end
function AppBase:onEnterForeground()
printInfo(“AppBase:onEnterForeground()…”)
self:dispatchEvent({name = AppBase.APP_ENTER_FOREGROUND_EVENT})
end
有人说quick 2.2.4可以调用成功,但是我看了下是用的CCNotificationCenter来处理的~