I am new in iOS. I am make a chat application. I am using UITableView
for display the message chat (one cell - one message).
In each cell, I will rounder the message in 2,3 or 4 corner (like Facebook chat)
For rounder I use the UIBezierPath
inside layoutSubView
of each Tableview Cell
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.messageView.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerBottomLeft) cornerRadii:CGSizeMake(3.0, 3.0)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bounds;
maskLayer.path = maskPath.CGPath;
self.messageView.layer.mask = maskLayer;
The problem is, when layout first initial, everything work fine, but when I scroll some cell have wrong rounder ( I figure out the problem is sometime when scroll self.messageView.bounds
return wrong value so UIBezierPath
draw wrong corner) but I don't know why
How can I prevent it happened?
Or Can I have another way to rounder View without UIBezierPath
(I google but I only find one way to rounder the UIView is using UIBezierPath
:( )?
Any help would be appreciated
rounder the message in 2,3 or 4 corner
, your code only make rounder in 4 corners – AscariasisUIBezierPath
like my code – Ascariasis