码迷,mamicode.com
首页 > 移动开发 > 详细

IOS小知识纪录

时间:2015-10-26 01:54:27      阅读:219      评论:0      收藏:0      [点我收藏+]

标签:

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(0, 0, 100, 100);
     label.layer.cornerRadius = 50;
    //label.layer.masksToBounds=YES;
     label.clipsToBounds = YES;

 

IOS小知识纪录

标签:

原文地址:http://www.cnblogs.com/yangjingqi/p/4910076.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!