预制体 Mask Layout ScorllView组件使用
预制体
1: 制作预制体: 将节点拖入到assets文件夹下;
2: 加载预知体: 代码加载(统一在资源加载时讲解)与手动绑定;
3: 预制体对象实例化: cc.instantiate;
cc.Class({
extends: cc.Component,
properties: {
// foo: {
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
//手动绑定
item_prefab: {

本文详细介绍了Cocos Creator中预制体、Mask组件、cc.Layout和cc.ScrollView的使用方法。预制体涉及创建、加载和实例化;Mask组件用于设置视口,控制显示区域;cc.Layout简化了内容布局,支持动态排版;cc.ScrollView则展示了如何实现滚动列表,包括内容排版和选项添加。
最低0.47元/天 解锁文章
3990

被折叠的 条评论
为什么被折叠?



