는 u는있는 UIView의 레이어 속성에 추가 할 수있는 CALayer을 그릴 수있는 샘플 코드를 참조 AT- 문서는있다.
// self.opacity = .5;
CGMutablePathRef thePath = CGPathCreateMutable();
//CGPathMoveToPoint(thePath,NULL,100.0f,200.f);
CGPoint aOnePoint=CGPointMake(cgpoint.x,tipPoint.y);
CGPoint aTwoPoint=CGPointMake(cgpoint.x+5,460);
CGPoint aThreePoint=CGPointMake(320,100);
CGPoint aFourPoint=CGPointMake(320,tipPoint.y-25);
CGPoint points[]={aOnePoint,aTwoPoint,aFourPoint};
CGPathAddLines(thePath, NULL,points,3);
CGContextBeginPath(theContext);
CGContextAddPath(theContext, thePath);
//CAGradientLayer here...using the CGCreateGradient methods.
CGContextSetLineWidth(theContext,2.0f);
CGSize theShadowSize = CGSizeMake(4.0f,4.0f);
CGContextSetShadowWithColor(theContext, theShadowSize,3,[UIColor darkGrayColor].CGColor);
CGContextSetFillColorWithColor(theContext,[UIColor redColor].CGColor);
CGContextFillPath(theContext);
CFRelease(thePath);
}
이 방법 당신은 당신의 자신의 계층을 그리고 뷰의 속성을 .layer에 추가 할 수 있습니다. 사용자 지정 레이어를 사용하려면 - (void)drawInContext:(CGContextRef)theContext
을 재정의해야합니다. 도움이
희망 ..
으음를 호출 할 필요가있다, 내 질문은 어떻게 상위 레이어로 설정하기 위해 자사의 그라데이션을 그리는 방법에 대해입니까? – HenryH