I need help to create an image similar to this:
Asked
Active
Viewed 58 times
1 Answers
1
If you create a subclass of UIView
, e.g. CustomView
, the only thing you need to do is implement the drawRect:
method:
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
// set fill & stroke color
[[UIColor blueColor] setStroke];
[[UIColor purpleColor] setFill];
// create blocks
CGFloat blockWidth = self.bounds.size.width / 3;
CGFloat blockHeight = self.bounds.size.height;
for (int i = 0; i < 3; i++) {
UIBezierPath *path = [UIBezierPath bezierPathWithRect:
CGRectMake(blockWidth * i, 0, blockWidth, blockHeight);
path.lineWidth = 2;
[path fill];
[path stroke];
}
}

Glorfindel
- 21,988
- 13
- 81
- 109
-
Thank you for the answer, I need to covert that view to image. It works for me for now. – makboney Jul 25 '15 at 10:27
-
That's rather easy: I found some code [here](http://stackoverflow.com/questions/6895090/how-to-convert-uiview-to-uiimage-without-background). But in that case, you're better off using a drawing program like GIMP. – Glorfindel Jul 25 '15 at 10:29