swift UIButton 设置动态图片
来源:互联网 发布:ar卡片制作软件 编辑:程序博客网 时间:2024/05/16 07:25
一般的gif图片大家应该不陌生,那么如何给UIButton设置一个动态的图片了
其实很简单 我们先看下代码
- var image=UIImage.animatedImageNamed("test", duration: 2.0)
- let btn1=UIButton.buttonWithType(UIButtonType.System) as! UIButton
- btn1.frame=CGRectMake(20, 50, 320, 36);
- btn1.setImage(image, forState: UIControlState.Normal)
- self.view.addSubview(btn1);
新建image的时候我们给了一个参数 “test”
我们只需要在工程中放入一组动画图片,命名规则为test0 tes1 test2 这样名称的图片就会自动被识别,并循环播放
好了 只要按照上边的要求实现。运行一下就能看到 button上的图片在动了
0 0
- Swift UIButton设置动态图片
- swift UIButton 设置动态图片
- Swift UIButton 的设置
- UIButton图片设置
- uibutton设置网络图片
- UIButton 设置图片显示contentmode
- UIButton 设置图片显示 contentmode
- UIButton设置图片和文字
- swift设置UIButton的title文字
- swift UIButton
- Swift UIButton
- swift uibutton
- UIButton swift
- swift UIButton
- swift UIButton
- UIBUtton需同时设置图片和文字
- iOS UIButton 设置图片不变型 setImage:
- iOS UIButton 设置图片文字垂直排列
- 第3条:用私有构造器或者枚举类型强化Singleton属性
- xpath相对当前节点定位方法总结
- 对于MSP430与SIM900A无法通信的问题解决
- 编程之美-求二进制数中1的个数方法整理
- zoj 1601 Count the Colorst(线段树)
- swift UIButton 设置动态图片
- 在request中获取项目路径
- @Controller
- ContentProvider原理及实例
- lock()与lockInterruptibly()的区别
- 伍德里奇计量经济学导论之计算机操作题的R语言实现(多元回归:估计)
- 单纯BLOCK的执行
- ThinkPHP3.2.3---更换easyui主题(theme)
- linux下软件包tar.gz, rpm,deb的安装方法