This one:
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(x, y, width, 1)];
view.backgroundColor = [UIColor whiteColor];
view.alpha = 0.1;
or this one:
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(x, y, width, 1)];
view.backgroundColor = [UIColor colorWithWhite:1.0 alpha:0.1];
or is there any third alternative? Using a UIImageView with image? Doing custom drawing with CoreGraphics? What is supposed to be fastest?
The fastest way would be to create a CALayer. Using this will allow you to easily alter its color/opacity if needed.
If you want to draw a line right onto an existing view and have it stay there with no altering you can add the following code to the drawRect: method of the existing view: