答案 0 :(得分:0)
您需要一个带有集合视图子控制器和图像视图的视图控制器。为您的集合视图实现自定义初始化程序,例如
- for attribute in @user.attributes.keys
%p
= attribute.humanize
= @user.attributes[attribute].to_s
// Custom initializer for the CV controller. Diameter is the
// diameter of the round photo.
- (id)initWithPhotoDiameter:(CGFloat)diameter
{
// Configure the layout
UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
layout.itemSize = CGSizeMake(diameter, diameter*1.50f); // Allow some vertical space for the label
layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
layout.minimumLineSpacing = 8.0f;
// Init the collection view
self = [super initWithCollectionViewLayout:layout];
if (self) {
_photoDiameter = diameter;
}
return self;
}
会有代码更改圆形照片的透明度,并更改图像视图上的图像以匹配圆形照片。理想情况下(但不严格地说)该代码在委托中,在这种情况下,委托是集合视图控制器的父视图控制器。