IOS小知识纪录

1.scrollView缩放

#import "ViewController.h"

@interface ViewController () <UIScrollViewDelegate>
@property (weak, nonatomic) IBOutlet UIScrollView *scrollView;
@property (weak, nonatomic) IBOutlet UIImageView *mView;
@end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad]; //1.设置内容尺寸
self.scrollView.contentSize=self.mView.frame.size; //2.设置代理
self.scrollView.delegate=self; //3.设置最大和最小的缩放比例 --设置之后才会有缩放效果
self.scrollView.maximumZoomScale=2.0;
self.scrollView.minimumZoomScale=0.2; } - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
return self.mView;
} @end

2.让ui主线程循环调用定时器

    self.timer =[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(method) userInfo:nil repeats:YES];

    //让ui主线程 循环调用定时器
[[NSRunLoop currentRunLoop] addTimer:self.timer forMode:NSRunLoopCommonModes];

3.使用lable控件做一个圆

     label.frame = CGRectMake(, , , );
label.layer.cornerRadius = ;
//label.layer.masksToBounds=YES;
label.clipsToBounds = YES;
上一篇:[ActionScript 3.0] AS3 获取函数参数个数


下一篇:Java的多线程 简单入门