You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
148 lines
0 B
148 lines
0 B
1 year ago
|
//
|
||
|
// DiscoverViewController.m
|
||
|
// tongxin
|
||
|
//
|
||
|
// Created by ecell on 2023/6/14.
|
||
|
// Copyright © 2023 xTT. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#import "DiscoverViewController.h"
|
||
|
#import "DiscoverTableViewCell.h"
|
||
|
#import "SingViewController.h"
|
||
|
|
||
|
@interface DiscoverViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||
|
|
||
|
@property (nonatomic ,strong) UITableView *disTableView;
|
||
|
|
||
|
@property (nonatomic ,strong) UIView *headerView;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation DiscoverViewController
|
||
|
|
||
|
- (void)viewDidLoad {
|
||
|
[super viewDidLoad];
|
||
|
// Do any additional setup after loading the view.
|
||
|
|
||
|
self.zx_navBarBackgroundColor = KKClearColor;
|
||
|
self.zx_navTitle = @"发现";
|
||
|
self.view.backgroundColor = RGB(233, 247, 255);
|
||
|
UIImageView *topImg = [UIImageView new];
|
||
|
topImg.image = ImageName_(@"comm_top_img");
|
||
|
topImg.frame = CGRectMake(0, 0, ScreenWidth, topImg.image.size.height);
|
||
|
[self.view addSubview:topImg];
|
||
|
|
||
|
// [self zx_setRightBtnWithImg:ImageName_(@"icon_nav_search") clickedBlock:^(ZXNavItemBtn * _Nonnull btn) {
|
||
|
//
|
||
|
// }];
|
||
|
[self.view addSubview:self.disTableView];
|
||
|
}
|
||
|
|
||
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||
|
{
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||
|
{
|
||
|
return 55;
|
||
|
}
|
||
|
|
||
|
|
||
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||
|
{
|
||
|
DiscoverTableViewCell *cell = [DiscoverTableViewCell cellWithTableView:tableView indexPath:indexPath];
|
||
|
[cell setCellText:indexPath.row == 0 ? @"任务中心" : @"我的兑换" :indexPath.row == 0 ? @"icon_task" : @"icon_gift"];
|
||
|
return cell;
|
||
|
}
|
||
|
|
||
|
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||
|
{
|
||
|
if (indexPath.row == 0)
|
||
|
{
|
||
|
SingViewController *vc = [[SingViewController alloc] init];
|
||
|
[self.navigationController pushViewController:vc animated:YES];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
|
||
|
//
|
||
|
// return 15;
|
||
|
//}
|
||
|
//
|
||
|
//- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
|
||
|
// return 15;
|
||
|
//}
|
||
|
|
||
|
- (UITableView *)disTableView
|
||
|
{
|
||
|
if (!_disTableView)
|
||
|
{
|
||
|
_disTableView = [[UITableView alloc] init];
|
||
|
if (@available(iOS 13.0, *)) {
|
||
|
_disTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, iPhoneX_NavHeight, ScreenWidth, ScreenHeight-iPhoneX_NavHeight) style:UITableViewStyleInsetGrouped];
|
||
|
} else {
|
||
|
_disTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, iPhoneX_NavHeight, ScreenWidth, ScreenHeight-iPhoneX_NavHeight) style:UITableViewStyleGrouped];
|
||
|
}
|
||
|
_disTableView.delegate = self;
|
||
|
_disTableView.dataSource = self;
|
||
|
//_disTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||
|
_disTableView.backgroundColor = KKClearColor;
|
||
|
// _disTableView.tableHeaderView = self.headerView;
|
||
|
// _disTableView.tableHeaderView.height = 185;
|
||
|
// _disTableView.tableHeaderView.height = 145;
|
||
|
[_disTableView registerClass:DiscoverTableViewCell.class forCellReuseIdentifier:NSStringFromClass(DiscoverTableViewCell.class)];
|
||
|
}
|
||
|
return _disTableView;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
- (UIView *)headerView
|
||
|
{
|
||
|
if (!_headerView)
|
||
|
{
|
||
|
_headerView = [UIView new];
|
||
|
_headerView.backgroundColor = KKClearColor;
|
||
|
// _headerView.frame = CGRectMake(0, 0, ScreenWidth, 185);
|
||
|
_headerView.frame = CGRectMake(0, 0, ScreenWidth, 145);
|
||
|
|
||
|
// UISearchBar *searchBar = [[UISearchBar alloc] init];
|
||
|
// searchBar.backgroundColor = [UIColor clearColor];
|
||
|
// searchBar.showsCancelButton = NO;
|
||
|
// searchBar.placeholder = @"搜索你想要的内容";
|
||
|
// searchBar.layer.borderWidth = 1;
|
||
|
// searchBar.layer.borderColor = mainColor.CGColor;
|
||
|
// searchBar.layer.cornerRadius = 15;
|
||
|
// searchBar.layer.masksToBounds = YES;
|
||
|
// [_headerView addSubview:searchBar];
|
||
|
// [searchBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
// make.left.right.equalTo(_headerView).inset(20);
|
||
|
// make.top.equalTo(_headerView).offset(10);
|
||
|
// make.height.mas_equalTo(30);
|
||
|
// }];
|
||
|
|
||
|
UIImageView *topImg = [UICommon ui_imageView:CGRectZero fileName:@"金币商城"];
|
||
|
[_headerView addSubview:topImg];
|
||
|
[topImg mas_makeConstraints:^(MASConstraintMaker *make) {
|
||
|
make.left.right.equalTo(_headerView).inset(20);
|
||
|
make.height.mas_equalTo(topImg.image.size.height);
|
||
|
// make.top.equalTo(searchBar.mas_bottom).offset(15);
|
||
|
make.top.equalTo(_headerView).offset(10);
|
||
|
}];
|
||
|
}
|
||
|
return _headerView;
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
#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
|