Skip to content

Instantly share code, notes, and snippets.

View zhangkn's full-sized avatar
❣️
https://kunnan.blog.csdn.net/

公众号:iOS逆向 zhangkn

❣️
https://kunnan.blog.csdn.net/
View GitHub Profile
- (NSString *)openUDID{
if (_openUDID == nil || [_openUDID isEqualToString:@""]) {
KNKeychainItemWrapper *wrapper = [[KNKeychainItemWrapper alloc] initWithIdentifier:@"kn.openUdid"accessGroup:nil];
// 读测试
NSString *openUDID = [wrapper objectForKey:(__bridge id)kSecValueData];
NSLog(@"读出_openUDID:%@",openUDID);
if (openUDID == nil || [openUDID isEqualToString:@""])
{
//方式一:有缓存(图片所占用的内存会一直停留在程序中)
+ (UIImage *)imageNamed:(NSString *)name;//name是图片的文件名
//方式二:无缓存(图片所占用的内存会在一些特定操作后被清除)
+ (UIImage *)imageWithContentsOfFile:(NSString *)path
- (id)initWithContentsOfFile:(NSString *)path;//path是图片的全路径
@property(nonatomic,copy) NSArray *animationImages; //需要播放的序列帧图片数组(里面都是UIImage对象,会按顺序显示里面的图片)
@property(nonatomic) NSTimeInterval animationDuration;//帧动画的持续时间
@property(nonatomic) NSInteger animationRepeatCount; //帧动画的执行次数(默认是无限循环)
- (void)startAnimating;//开始执行帧动画
- (void)stopAnimating;//停止执行帧动画
- (BOOL)isAnimating;//是否正在执行帧动画
@zhangkn
zhangkn / arrayWithContentsOfFile.m
Created June 4, 2018 02:41
接下来通过代码来解析Plist文件中的数据
- (NSArray *)images
{
if (_images == nil) {
NSBundle *bundle = [NSBundle mainBundle];
NSString *path = [bundle pathForResource:@"imageData" ofType:@"plist"];
_images = [NSArray arrayWithContentsOfFile:path];
}
return _images;
}
var image = wx.createImage()
// 设置 Image 对象的 src 属性可以加载一张本地图片或网络图片,当图片加载完毕时会执行注册的 onload 回调函数,此时可以将 Image 对象绘制到 Canvas 上。
image.onload = function () {
console.log(image.width, image.height)
context.drawImage(image, 0, 0)
}
image.src = 'logo.png'

小游戏开发者通过在根目录编写一个 game.json 文件进行配置,开发者工具和客户端需要读取这个配置,完成相关界面渲染和属性设置。

key 数据类型 说明 默认值

说明:

  • wx.on 开头的 API 是监听某个事件发生的API接口,接受一个 CALLBACK 函数作为参数。当该事件触发时,会调用 CALLBACK 函数。
  • 如未特殊约定,其他 API 接口都接受一个OBJECT作为参数。
  • OBJECT中可以指定success, fail, complete来接收接口调用结果。
参数名
<image mode="widthFix" class="-icon" src="../assets/images/icons/_bg.png"></image>
属性名 类型 说明 最低版本

open-type 有效值:

说明 最低版本