UI基础 - UILabel

 

//根据文字获取size

- (CGSize)getSizeWithstring:(NSString *)string

{

    CGSize maxSize = CGSizeMake(320, 320);

    NSDictionary *dict = @{NSFontAttributeName : [UIFont systemFontOfSize:11.0]};

    CGSize size = [string boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesFontLeading attributes:dict context:nil].size;

    return size;

}

posted @ 2016-04-01 14:57  偏执Dog  阅读(159)  评论(0编辑  收藏  举报