版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhenyu5211314/article/details/83752712
UIImageView公有属性、方法
/**
* 创建一个UIImageView实例
* @param imageFileName 图片
* @param texType 图片类型(Local、Plist)
* @return UIImageView实例
*/
static ImageView* create(const std::string& imageFileName, TextureResType texType = TextureResType::LOCAL);
/**
* 加载图片
* @param fileName 图片
* @param texType 图片类型(Local、Plist)
*/
void loadTexture(const std::string& fileName,TextureResType texType = TextureResType::LOCAL);
/**
* 设置UIImageView的位置和大小
*/
void setTextureRect(const Rect& rect);
/**
* 设置是否开启九宫格
* @param 是否开启九宫格
*/
void setScale9Enabled(bool enabled);
/**
* 获取是否开启九宫格
*/
bool isScale9Enabled()const;
/**
* 设置九宫格的拉伸范围
* @param capInsets 拉伸范围
*/
void setCapInsets(const Rect &capInsets);
/**
* 获取九宫格的拉伸范围
*/
const Rect& getCapInsets()const;
UIImageView 示例
var radio_uncheck = "btn_radio_uncheck.png";
var node = new ccui.ImageView(radio_uncheck, ccui.Widget.PLIST_TEXTURE);
node.setPosition(640, 360);
this.addChild(node);