0
그래디언트로 채워진 상자를 그려야합니다. UIView 사용하고 -drawRect 메서드를 덮어 씁니다. 현재iPhone : 그리기 그라디언트의 너비를 제어 할 수 없습니까?
CGContextRef c = UIGraphicsGetCurrentContext();
CGFloat components[8] = {158.0/255.0,36.0/255.0,134.0/255.0,1.0,115.0/255.0,26.0/255.0,93.0/255.0,1.0};
CGColorSpaceRef rgbColorspace = CGColorSpaceCreateDeviceRGB();
CGFloat locations[2] = {0.0,1.0};
CGGradientRef glossGradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, 2);
CGPoint topCenter = CGPointMake(10, 0);
CGPoint bottomCenter = CGPointMake(10, 10);
CGContextDrawLinearGradient(c, glossGradient, topCenter, bottomCenter, 0);
그라데이션 채우기 뷰의 전체 폭을 채우 :
여기 간체 내 코드! 그리는 그라데이션 채우기 상자의 너비를 제어하려면 어떻게해야합니까?