-(void)autoSetLabWidthForLab:(UILabel *)lab
{
// NSLog(@"t-> %@",lab.text);
lab.layer.masksToBounds=YES;
lab.layer.cornerRadius=11;
lab.numberOfLines=0;
lab.textAlignment=UITextAlignmentCenter;
lab.font=[UIFont fontWithName:@"Arial" size:14.0];
lab.textColor=[UIColor whiteColor];
UIFont *font = [UIFont fontWithName:@"Arial" size:14.0];
CGSize size = CGSizeMake(400,30);
CGSize labelsize = [lab.text sizeWithFont:font constrainedToSize:size lineBreakMode:NSLineBreakByWordWrapping];
CGRect r=lab.frame;
if (labelsize.width<16) {
r.size.width=2*labelsize.width+10;
}else{
r.size.width=labelsize.width+10;
}
[lab setFrame:r];
}