一般情况下,所谓流式布局,大都是瀑布流图片,是竖向排版布局的,但是有时候我们会遇到横向排版布局的Label,鄙人不才,自己按照需要自定义了这样的一个view,话不多说,上代码:
实例化这个view,传入一个数组和需要的font
- (id)initWithFrame:(CGRect)frame WithArr:(NSArray *)aArr WithFont:(UIFont *)aFont;
{
self = [super initWithFrame:frame];
if (self) {
//初始化
CGFloat x = 0;
CGFloat y = 0;
for (int i = 0; i < [aArr count]; i ++) {
NSString *str = [aArr objectAtIndex:i];
CGSize size;
//IOS6 和IOS7 方法不同
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0f) {