#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
// [UIView transitionWithView:self.aView duration:2 options:UIViewAnimationOptionTransitionFlipFromRight animations:nil completion:nil];
self.aView.layer.borderColor=[[UIColor blackColor]CGColor];
// self.aView.layer.borderWidth=5;
// self.aView.layer.cornerRadius=10;//设置圆角
self.aView.layer.contents=(id)[UIImage imageNamed:@"l.jpg"].CGImage;
self.aView.layer.shadowColor=[UIColor blackColor].CGColor;
self.aView.layer.shadowOffset=CGSizeMake(10, 10);
self.aView.layer.shadowOpacity=1;
}
-(void)test2
{
if ([_fromView subviews]) {
[UIView transitionFromView:_fromView toView:_toView duration:2 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];
}else{
[UIView transitionFromView:_toView toView:_fromView duration:2 options:UIViewAnimationOptionTransitionFlipFromLeft completion:nil];
}
}
-(void)test1
{
[UIView animateWithDuration:2 animations:^{
self.aView.center=CGPointMake(300, 300);//设置动画的结束状态
} completion:^(BOOL finished) {
NSLog(@"js");
}];
}
-(void)test
{
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:2];
//self.aView.alpha=0;
// self.aView.center=CGPointMake(300, 300);
// self.aView.backgroundColor=[UIColor redColor];
[UIView setAnimationDelegate:self];
self.aView.bounds=CGRectMake(0, 100, 10, 10);
[UIView setAnimationDidStopSelector:@selector(stop)];
[UIView commitAnimations];
}
-(void)stop
{
NSLog(@"jieshu");
}
- (void)viewDidLoad {
// _showView=[[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];
// // _showView.backgroundColor=[UIColor yellowColor];
// _fromView=[[UIView alloc]initWithFrame:_showView.bounds];
// _fromView.backgroundColor=[UIColor blueColor];
//
// _toView=[[UIView alloc]initWithFrame:_showView.bounds];
//
// _toView.backgroundColor=[UIColor redColor];
//
//
// [self.view addSubview:_showView];
// // [_showView addSubview:_toView];
//
// [_showView addSubview:_fromView];
// CALayer *calayer=[CALayer new];
// calayer.backgroundColor=[UIColor orangeColor].CGColor;
// calayer.bounds=CGRectMake(100, 100, 200,200);
// [self.view.layer addSublayer:calayer];
NSLog(@"====%@",self.view.layer.sublayers);
NSLog(@"---%@",self.view.subviews);
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end