1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| -(CGRect)titleRectForContentRect:(CGRect)contentRect { CGFloat titleX=0; CGFloat titleY=0; NSDictionary *dict=@{ NSFontAttributeName:[UIFont systemFontOfSize:15] }; CGFloat titleW=[self.currentTitle boundingRectWithSize:CGSizeMake(MAXFLOAT, MAXFLOAT) options:NSStringDrawingTruncatesLastVisibleLine attributes:dict context:nil].size.width; CGFloat titleH=contentRect.size.height; return CGRectMake(titleX, titleY, titleW, titleH); } -(CGRect)imageRectForContentRect:(CGRect)contentRect { CGFloat imageW=30; CGFloat imageH=contentRect.size.height; CGFloat imageX=contentRect.size.width-imageW; CGFloat imageY=0; return CGRectMake(imageX, imageY, imageW, imageH); }
|