iOS 个人主页下拉放大 动效

2024-08-13  本文已影响0人  小黑技术

import "ViewController.h"

@interface ViewController () <UITableViewDataSource,UITableViewDelegate>

@property (weak, nonatomic) UIImageView *headerView;

@property (weak, nonatomic) UITableView *tableView;

@property (weak, nonatomic) UIView *tableViewHeaderView;

@end

@implementation ViewController

UIView *headerView = [[UIView alloc] init];
self.tableViewHeaderView = headerView;
headerView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 250);
headerView.backgroundColor = [UIColor clearColor];

UIImageView *headerViewWant = [[UIImageView alloc] init];
self.headerView = headerViewWant;

headerViewWant.image = [UIImage imageNamed:@"headerImage.jpg"];
headerViewWant.contentMode = UIViewContentModeScaleAspectFill;
headerViewWant.clipsToBounds = YES;
headerViewWant.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 250);
headerViewWant.backgroundColor = [UIColor yellowColor];


[tableView addSubview:headerViewWant];

tableView.tableHeaderView = headerView;

[self.view addSubview:tableView];

}

pragma mark - UITableViewDataSource

}

@end

上一篇 下一篇

猜你喜欢

热点阅读