calayer=[CALayer layer]; // SCMylayer *layer = [SCMylayer layer]; //2.设置layer的属性 calayer.backgroundColor=[UIColor clearColor].CGColor; calayer.bounds=CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT*0.5); calayer.anchorPoint=CGPointZero; calayer.position=CGPointMake(0, 108); calayer.delegate=self; [self.view.layer addSublayer:calayer]; color=[UIColor blackColor]; arrM=[NSMutableArray array]; isOpen=NO; } -(void)dealloc{ NSLog(@"------========="); [calayer removeFromSuperlayer]; //销毁是移除涂层 }
时间: 2024-10-19 14:32:54