2014-02-28 53 views
2

我正在使用Corona模擬器進行測試。我想刪除代碼下的滾動視圖。 如何清除小部件是這個?
我想知道如何刪除滾動視圖Corona widget.newScrollView錯誤

display.setStatusBar(display.HiddenStatusBar) 

    local widget = require("widget") 

    local scrollView = widget.newScrollView 
    { 
     left = 0, 
     top = 0, 
     width = display.contentWidth, 
     height = display.contentHeight, 
     bottomPadding = 50, 
     id = "onBottom", 
     horizontalScrollDisabled = true, 
     verticalScrollDisabled = false, 
     listener = scrollListener, 
    } 

    local titleText = display.newText("Move Up to Scroll", display.contentCenterX, 48, native.systemFontBold, 16) 
    titleText:setFillColor(0) 

    scrollView:insert(titleText) 

    local lotsOfText = "test " 

scrollView 
    local lotsOfTextObject = display.newText(lotsOfText, display.contentCenterX, 0, 300, 0, "Helvetica", 14) 
    lotsOfTextObject:setFillColor(0) 
    lotsOfTextObject.anchorY = 0.0  -- Top 
    lotsOfTextObject.y = titleText.y + titleText.contentHeight + 10 

    scrollView:insert(lotsOfTextObject) 


    display.remove(titleText) 
    display.remove(lotsOfTextObject) 
    display.remove(scrollView) 
    scrollView = nil 
+0

我不確定你在這裏問什麼... – HTX9

+0

我使用電暈模擬器來測試。我想刪除代碼下的滾動視圖。如何清除小部件是這樣的? 我想知道如何去除滾動視圖 – user3363061

回答

0

嘗試

scrollView:removeSelf() 
scrollView = nil 

,將刪除了滾動和它的內容,以及免費起來進行垃圾回收。

+0

這也造成了錯誤.... – user3363061