Button
来源:互联网 发布:软件开发外包管理制度 编辑:程序博客网 时间:2024/06/03 19:22
local bt = ccui.Button:create()
bt:loadTextures("cr_btn_gr_n.png", "cr_btn_gr_p.png", "", 1) --1:从plist文件中获取 0:从本地获取资源
bt:setCascadeOpacityEnabled(true)--开启透明度
bt:setScale9Enabled(true)
bt:setContentSize(cc.size(280, 60)) --按钮的大小
bt:loadTextureNormal("132.png",1)
bt:setPosition(cc.p(180, 270 - i * 90))
bt:setTouchEnabled(false)
bt:setEnabled(false)
bt:setBright(false)
bt:setTitleText("123")--按钮上的字
bt:setTitleFontName("Arial")
bt:setTitleFontSize(22)
layer:addChild(bt)
bt:addTouchEventListener(
function(sender, eventType)
if eventType == ccui.TouchEventType.ended then
--实现内容
end
end
)
-- bt:addTouchEventListener(upBtnCallback)
-- local function upBtnCallback(sender, eventType)
-- if eventType == ccui.TouchEventType.ended then
-- --实现内容
-- end
-- end
------------------------------ImageView--------------------------------
local imgIcon = ccui.ImageView:create()
imgIcon:loadTexture("cr_gem_tag.png", 1)
imgIcon:setPosition(cc.p(30, 30))
imgBk:setScale9Enabled(true)
imgBk:setCapInsets(cc.rect(15,15,1,1))
imgBk:setContentSize(cc.size(360, 360))
imgIcon:setTouchEnabled(false)
imgIcon:setOpacity(200)
layer:addChild(imgIcon)
bt:loadTextures("cr_btn_gr_n.png", "cr_btn_gr_p.png", "", 1) --1:从plist文件中获取 0:从本地获取资源
bt:setCascadeOpacityEnabled(true)--开启透明度
bt:setScale9Enabled(true)
bt:setContentSize(cc.size(280, 60)) --按钮的大小
bt:loadTextureNormal("132.png",1)
bt:setPosition(cc.p(180, 270 - i * 90))
bt:setTouchEnabled(false)
bt:setEnabled(false)
bt:setBright(false)
bt:setTitleText("123")--按钮上的字
bt:setTitleFontName("Arial")
bt:setTitleFontSize(22)
layer:addChild(bt)
bt:addTouchEventListener(
function(sender, eventType)
if eventType == ccui.TouchEventType.ended then
--实现内容
end
end
)
-- bt:addTouchEventListener(upBtnCallback)
-- local function upBtnCallback(sender, eventType)
-- if eventType == ccui.TouchEventType.ended then
-- --实现内容
-- end
-- end
------------------------------ImageView--------------------------------
local imgIcon = ccui.ImageView:create()
imgIcon:loadTexture("cr_gem_tag.png", 1)
imgIcon:setPosition(cc.p(30, 30))
imgBk:setScale9Enabled(true)
imgBk:setCapInsets(cc.rect(15,15,1,1))
imgBk:setContentSize(cc.size(360, 360))
imgIcon:setTouchEnabled(false)
imgIcon:setOpacity(200)
layer:addChild(imgIcon)
阅读全文
0 0
- button.
- button
- button
- button
- button
- button
- Button
- button
- Button
- Button
- button
- button
- Button
- Button
- Button
- Button
- button
- button
- EditBox
- Android中canvas常用方法
- struts in actin(Ted Husted 著)struts1 源码配置问题 记录
- JVM -XX: 参数介绍
- Windows下64位Apache+PHP+MySQL配置
- Button
- 《利用Python进行数据分析》笔记---第2章--1880-2010年间全美婴儿姓名
- FCN新手笔记,如何训练自己的模型
- API
- ImageView
- Python下使用subprocess中文乱码的解决方案
- 数字信号处理实验(一)
- validate表单验证用法 (一)
- STL之map应用 回文串