내 목숨 을 구 해 줬 어. quartz2D.
// // MyQuartzView.m // QuartzTest // // Created by zenny_chen on 12-2-21. // Copyright (c) 2012 GreenGames Studio. All rights reserved. // #import "MyQuartzView.h" // Quartz2D Core Animation #import <QuartzCore/QuartzCore.h> #import <CoreText/CoreText.h> @implementation MyQuartzView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } // Only override drawRect: if you perform custom drawing. // An empty implementation adversely affects performance during animation. - ( void )drawRect:(CGRect)rect { // Drawing code // Quartz CGContextRef context = UIGraphicsGetCurrentContext(); // alpha 1 CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); CGContextFillRect(context, CGRectMake(0.0f, 0.0f, self.frame.size.width, self.frame.size.height)); // iOS , , // CGContextTranslateCTM(context, 0.0f, self.frame.size.height); CGContextScaleCTM(context, 1.0f, -1.0f); // Path CGMutablePathRef path = CGPathCreateMutable(); // CGPathMoveToPoint Path CGPathMoveToPoint(path, &CGAffineTransformIdentity, 0.0f, self.frame.size.height); CGPathAddLineToPoint(path, &CGAffineTransformIdentity, 0.0f, 0.0f); CGPathAddLineToPoint(path, &CGAffineTransformIdentity, self.frame.size.width * 0.125f, 0.0f); CGPathAddLineToPoint(path, &CGAffineTransformIdentity, 0.0f, self.frame.size.height); CGPathCloseSubpath(path); // Path : // kCGBlendModeDestinationIn : alpha 0, CGContextSetBlendMode(context, kCGBlendModeDestinationIn); // path alpha 0 CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 0.0f); // Path Path CGContextAddPath(context, path); CGContextFillPath(context); CGPathRelease(path); } @end 그리고 메 인 컨트롤 러 안의 코드 를 다시 봅 시다.
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// // ViewController.m // QuartzTest // // Created by zenny_chen on 12-2-21. // Copyright (c) 2012 GreenGames Studio. All rights reserved. // #import "ViewController.h" #import "MyQuartzView.h" #import <QuartzCore/QuartzCore.h> @interface ViewController () @end @implementation ViewController - ( void )viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. // self.view.backgroundColor = [UIColor colorWithRed:0.2f green:0.2f blue:0.2f alpha:1.0f]; // UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(100.0f, 100.0f, 160.0f, 160.0f)]; aView.backgroundColor = [UIColor redColor]; [self.view addSubview:aView]; [aView release]; // , MyQuartzView *myView = [[MyQuartzView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 160.0f, 160.0f)]; // , alpha 0 myView.backgroundColor = [UIColor clearColor]; // layer layer mask aView.layer.mask = myView.layer; // , myView release , // aView.layer.mask = myView.layer myView retain 。 } - ( void )viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. } - ( BOOL )shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } @end
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Spring 통합 Quartz의 간단한 구성 방법그러나 실제 업무에서 직접 그것을 사용하는 것은 매우 드물다.일반적으로spring-quartz 구성 요소를 사용하며, 직접 설정을 통해spring 프레임워크를 자동으로 조립합니다 다음은spring 프레임워크 통합qu...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.