实现新浪弹簧出现效果

1.宏定义
//视图距离视图边框单间距
#define kOffset 20
//视图高度
#define kHeight 90
//视图宽度
#define kWidth 90
//视图与视图间距
#define kPadding ((self.view.frame.size.width-20-20-3*kWidth)*0.5)
2.创建一个数组放入即将弹出的视图
//创建数组
self.itemsArray = [NSMutableArray arrayWithCapacity:3];
//创建三个视图
for (int i = 0; i < 3; i++){
//创建一个视图
UIView *tempView = [[UIView alloc] initWithFrame:CGRectMake(kOffset + (kWidth + kPadding)*i, self.view.frame.size.height + 10, kWidth, kHeight)];
//视图由方形变为圆形
tempView.layer.cornerRadius = kWidth*0.5;
//视图背景颜色
tempView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:[self.imageNamesArray objectAtIndex:i]]];
[self.view addSub

4989

被折叠的 条评论
为什么被折叠?



