使用NSThread让字体一个一个弹出
来源:互联网 发布:什么软件可以四连拍 编辑:程序博客网 时间:2024/05/17 07:06
在开发中,经常可见字一个一个的弹出的情形,下面就使用NSThread来实现这种功能。
#import "ViewController.h"
@interface ViewController ()
@property (weak, nonatomic) IBOutletUILabel *titleLabel;
@property (copy , nonatomic)NSString *contentStr;
@end
@implementation ViewController
- (void)viewDidLoad {
[superviewDidLoad];
NSThread *thread = [[NSThreadalloc]initWithTarget:selfselector:@selector(animation)object:nil];
[thread start];
self.contentStr = @"我需要三件东西:爱情友谊和图书。然而这三者之间何其相通!炽热的爱情可以充实图书的内容,图书又是人们最忠实的朋友";
}
- (void)animation
{
for (NSInteger i =0; i <self.contentStr.length; i++)
{
[selfperformSelectorOnMainThread:@selector(refreshUIWithContentStr:)withObject:[self.contentStrsubstringWithRange:NSMakeRange(0, i+1)]waitUntilDone:YES];
[NSThreadsleepForTimeInterval:0.3];
}
}
- (void)refreshUIWithContentStr:(NSString *)contentStr
{
self.titleLabel.text = contentStr;
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
- 使用NSThread让字体一个一个弹出
- NSThread 使用
- 让wine程序使用所有字体
- 让你的网站使用个性化字体
- NSThread 多线程使用,以及NSThread 停止
- js/jquery让数字号码一个一个出来的效果
- NSThread使用总结
- 使用NSThread起线程
- NSThread使用具体说明
- NSThread的使用
- NSThread介绍和使用
- NSthread线程使用
- NSThread的使用
- 使用NSThread创建线程
- NSThread的使用
- 学习:NSThread的使用
- NSThread的使用
- 88-NSThread的使用
- 简单的spring使用反射实现属性赋值demo
- IOS开发选择图片(相机或者图库)
- Layout 的clone
- oracle--物化视图
- opencl:改造C++接口增加对内存编译(compile)的支持
- 使用NSThread让字体一个一个弹出
- mysql查询今天、昨天、上周
- 自定义初学2——扩展View
- FragmentTabHost、Fragment实现底部点击切换Tab页面
- HTTP基本原理(http1.0与http1.1之区别)
- Android中使用Handler造成内存泄露的分析和解决
- HEVC参考帧管理(RPS)
- Android的Native方式广播intent
- Mocha、chai、phantomjs应用小结