加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
FileDetailViewController.m 2.48 KB
一键复制 编辑 原始数据 按行查看 历史
xiexiaolong.xxl 提交于 2024-06-18 15:06 . init
//
// FileDetailViewController.m
// pkoa
//
// Created by HG on 2022/2/17.
// Copyright © 2022 com.kinggrid. All rights reserved.
//
#import "FileDetailViewController.h"
#import "FileDetailNaviView.h"
@interface FileDetailViewController ()
<
UIScrollViewDelegate,
FileDetailNaviViewDelegate
>
@property (nonatomic , strong) FileDetailNaviView *naviView;//导航分栏
@property (nonatomic , strong) UIScrollView *contentView;
@end
@implementation FileDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self initView];
}
- (void)initView
{
self.naviView.frame = CGRectMake(100, HEIGHT_STATUSBAR, MAIN_WIDTH - 150, HEIGHT_NAVIGATION_NEW - HEIGHT_STATUSBAR);
self.contentView.frame = CGRectMake(0, HEIGHT_NAVIGATION_NEW, MAIN_WIDTH, MAIN_HEIGHT - HEIGHT_NAVIGATION_NEW - HEIGHT_TAB_BOTTOM);
self.contentView.contentSize = CGSizeMake(MAIN_WIDTH * 3, MAIN_HEIGHT - HEIGHT_NAVIGATION_NEW - HEIGHT_TAB_BOTTOM);
}
#pragma mark --FileDetailNaviViewDelegate
- (void)clickWithIndex:(NSInteger)index
{
[UIView animateWithDuration:0.2 animations:^{
self.contentView.contentOffset = CGPointMake(MAIN_WIDTH*index, 0);
}];
}
#pragma mark -- UIScrollViewDelegate
#pragma mark -- getter
- (FileDetailNaviView *)naviView
{
if (!_naviView) {
_naviView = [[FileDetailNaviView alloc] init];
_naviView.delegate = self;
[navigationBG addSubview:_naviView];
}
return _naviView;
}
- (UIScrollView *)contentView
{
if (!_contentView) {
_contentView = [[UIScrollView alloc] init];
_contentView.pagingEnabled = YES;
UIView *testView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, MAIN_WIDTH, MAIN_HEIGHT - HEIGHT_NAVIGATION_NEW - HEIGHT_TAB_BOTTOM)];
testView.backgroundColor = [UIColor orangeColor];
[_contentView addSubview:testView];
UIView *testBView = [[UIView alloc] initWithFrame:CGRectMake(MAIN_WIDTH, 0, MAIN_WIDTH, MAIN_HEIGHT - HEIGHT_NAVIGATION_NEW - HEIGHT_TAB_BOTTOM)];
testBView.backgroundColor = [UIColor systemPinkColor];
[_contentView addSubview:testBView];
UIView *testCView = [[UIView alloc] initWithFrame:CGRectMake(MAIN_WIDTH*2, 0, MAIN_WIDTH, MAIN_HEIGHT - HEIGHT_NAVIGATION_NEW - HEIGHT_TAB_BOTTOM)];
testCView.backgroundColor = [UIColor greenColor];
[_contentView addSubview:testCView];
_contentView.delegate = self;
[self.view addSubview:_contentView];
}
return _contentView;
}
@end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化