In your UIView+Bubble.h category UIBezierPath tries to draw triangle on a null context. If you want to draw shape using UIBezierPath like above, you have to put this code inside drawRect
method of a View class.
On the other hand, you could create a new context to draw. You may modify your makeBubble method as follow:
+(UIView *)makeBubble{
// declare UIimageView, not UIView
UIImageView *customView = [[UIImageView alloc] init];
customView.frame=CGRectMake(0, 0, 320, 500);
// create a new contex to draw
UIGraphicsBeginImageContextWithOptions(CGSizeMake(200, 200), NO, 0);
UIBezierPath *triangle = [UIBezierPath bezierPath];
[triangle moveToPoint:CGPointMake(100, 0)];
[triangle addLineToPoint:CGPointMake(0, 100)];
[triangle addLineToPoint:CGPointMake(200, 100)];
[triangle closePath];
[[UIColor blackColor] setFill];
[triangle fill];
customView.image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return customView;
}
EDIT:
to make it dynamic you could pass a cgRect argument, like
+(UIView *)makeBubble:(CGRect)rect
also change to customView.frame=rect;
and UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);
inside this method. And call makeBubble:(CGRect)rect method as
UIView *helpBubble=[UIView makeBubble:/*your desire rect*/];
P.S. it will be great if you calculate the points depending on the rect too.