我有一个带有UIVIewcontroller的故事板场景.在这个场景中,我有一个包含背景图像的UIImageview,一个UIButton和一个UIView.
这个UIView有一个覆盖的drawRect方法:
- (void)drawRect:(CGRect)rect
{
[super drawRect:rect];
[self setNeedsDisplay];
CGFloat height = self.bounds.size.height;
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextClearRect(context, rect);
CGContextSetFillColorWithColor(context, [UIColor grayColor].CGColor);
CGFloat barWidth = 30;
int count = 0;
NSArray *values = [NSArray arrayWithObjects:@1, @0.5, nil];
for (NSNumber *num in values) {
CGFloat x = count * (barWidth + 10);
CGRect barRect = CGRectMake(x, height - ([num floatValue] * height), barWidth, [num floatValue] * height);
CGContextAddRect(context, barRect);
count++;
}
CGContextFillPath(context);
}
Run Code Online (Sandbox Code Playgroud)
我的问题是:我怎样才能将图像设置为我的自定义UIView的背景并在其上绘制矩形?
问候
我已经在Google Cloud上用bitnami图像安装了Jenkins。但是我想将基本根路径从/ jenkins更改为/,但是直到现在我还是不能这样做。我已经尝试了bnconfig --appurl /,但是没有用。任何的想法?