重写drawrect
{
if (isWithStrikeThrough)
{
CGSize contentSize = [self.text sizeWithFont:self.font constrainedToSize:self.frame.size];
CGContextRef c = UIGraphicsGetCurrentContext();
CGFloat color[4] = {0.667, 0.667, 0.667, 1.0};
CGContextSetStrokeColor(c, color);
CGContextSetLineWidth(c, 2);
CGContextBeginPath(c);
CGFloat halfWayUp = (self.bounds.size.height - self.bounds.origin.y) / 2.0;
CGContextMoveToPoint(c, self.bounds.origin.x, halfWayUp );
CGContextAddLineToPoint(c, self.bounds.origin.x + contentSize.width, halfWayUp);
CGContextStrokePath(c);
}
[super drawRect:rect];
}