#import “oneViewController.h”
@interface oneViewController ()<UITableViewDelegate,UITableViewDataSource,UICollectionViewDelegate,UICollectionViewDataSource>
{
UITableView *tb;
UICollectionView *coll;
}
@end
static NSString *re1 = @“325”;
@implementation oneViewController
-
(void)viewDidLoad {
[super viewDidLoad];
// UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 64)];
// img.image = [UIImage imageNamed:@“6”];
// self.navigationController.navigationBar.barTintColor = [UIColor colorWithPatternImage:img.image];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@“4”] style:UIBarButtonItemStyleDone target:self action:nil];
UISearchBar *se = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];
se.placeholder = @“圣诞节会发光会死啊客户”;
self.navigationItem.titleView = se;
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@“5”] style:UIBarButtonItemStyleDone target:self action:nil];tb = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStyleGrouped];
tb.delegate = self;
tb.dataSource =self;
[self.view addSubview:tb];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section == 0) {
return 3;
}else
{
return 1;
}
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *re = @"";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:re];
if(!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:re];
}
if(indexPath.section == 0)
{
if(indexPath.row == 0)
{
tb.rowHeight = 140;
UIScrollView *sr = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 140)];
sr.contentSize = CGSizeMake(self.view.frame.size.width * 3, 0);
sr.pagingEnabled = YES;
sr.bounces = NO;
sr.showsHorizontalScrollIndicator = NO;
for(int i = 0;i<3 ;i ++)
{
UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.frame.size.width * i, 0, self.view.frame.size.width, 140)];
img.image = [UIImage imageNamed:@"8"];
[sr addSubview:img];
}
[cell addSubview:sr];
}else if(indexPath.row == 1)
{
tb.rowHeight = 70;
UIImageView *img1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 70)];
img1.image = [UIImage imageNamed:@"7"];
[cell addSubview:img1];
}else if(indexPath.row == 2)
{
tb.rowHeight = 200;
UICollectionViewFlowLayout *lay = [[UICollectionViewFlowLayout alloc] init];
lay.itemSize = CGSizeMake((self.view.frame.size.width - 3)/4, (self.view.frame.size.width - 3)/4);
lay.minimumLineSpacing = 1;
lay.minimumInteritemSpacing = 1;
coll = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, (self.view.frame.size.width - 3)/4 * 3 +2) collectionViewLayout:lay];
coll.delegate = self;
coll.dataSource = self;
[coll registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:re1];
coll.backgroundColor = [UIColor whiteColor];
[cell addSubview:coll];
}
}else if(indexPath.section == 1)
{
tb.rowHeight = 140;
UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 140)];
img.image = [UIImage imageNamed:@"8"];
[cell addSubview:img];
}else
{
tb.rowHeight = 140;
UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 140)];
img.image = [UIImage imageNamed:@"8"];
[cell addSubview:img];
}
return cell;
}
-(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return 8;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell1 = [collectionView dequeueReusableCellWithReuseIdentifier:re1 forIndexPath:indexPath];
UIImageView *img2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
NSArray *arr = @[@“01”,@“01”,@“01”,@“01”,@“01”,@“01”,@“01”,@""];
img2.image = [UIImage imageNamed:arr[indexPath.row]];
[cell1 addSubview:img2];
return cell1;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
#import “twoViewController.h”
#import “oneViewController.h”
@interface twoViewController ()
@end
@implementation twoViewController
-
(void)viewDidLoad {
[super viewDidLoad];
self.navigationItem.title = @“登陆”;
self.view.backgroundColor = [UIColor whiteColor];
UIImageView *img = [[UIImageView alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 200)/2, 100, 200, 200)];
img.image = [UIImage imageNamed:@“1”];
[self.view addSubview:img];
UITextField *tf = [[UITextField alloc] initWithFrame:CGRectMake(40, 300, self.view.frame.size.width, 50)];
tf.placeholder = @" 请输入手机号";
[self.view addSubview:tf];UITextField *tf1 = [[UITextField alloc] initWithFrame:CGRectMake(40, 360, self.view.frame.size.width, 50)];
tf1.placeholder = @" 请输入登录密码";
[self.view addSubview:tf1];UIImageView *img1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 300, 40, 40)];
img1.image = [UIImage imageNamed:@“2”];
[self.view addSubview:img1];UIImageView *img2 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 360, 40, 40)];
img2.image = [UIImage imageNamed:@“3”];
[self.view addSubview:img2];UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 350)/ 2, 450, 350, 50)];
btn.layer.masksToBounds = YES;
btn.layer.cornerRadius = 10;
btn.backgroundColor = [UIColor orangeColor];
[btn setTitle:@“登陆” forState:UIControlStateNormal];
[btn addTarget:self action:@selector(qwe) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn];UIButton *btn1 = [[UIButton alloc] initWithFrame:CGRectMake((self.view.frame.size.width - 350)/ 2, 520, 350, 50)];
btn1.layer.masksToBounds = YES;
btn1.layer.cornerRadius = 10;
btn1.backgroundColor = [UIColor orangeColor];
[btn1 setTitle:@“注册” forState:UIControlStateNormal];
[btn1 addTarget:self action:@selector(qwe) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn1];
}
-(void)qwe
{
oneViewController *one = [oneViewController new];
[self.navigationController pushViewController:one animated:YES];
} -
(void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end