BBASideLeavingBlankView.h
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// BBASideLeavingBlankView.h
// BBAUIKit
//
// Created by jilutao on 2020/5/26.
// Copyright © 2020 Baidu. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/* 实现两侧留白的View中留白区域与内容区滚动联动,使用方法
第一种方式,自定义self.view
```objective-c
- (void)loadView {
self.view = [[BBASideLeavingBlankView alloc] init];
}
- (void)viewDidLoad {
[super viewDidLoad];
[self initTableView];
BBASideLeavingBlankView *leavingBlankView = (BBASideLeavingBlankView *)self.view;
[leavingBlankView addReceiver:self.tableView];
}
```
第二种方式,添加到self.view上
```objective-c
- (void)viewDidLoad {
[super viewDidLoad];
[self initTableView];
BBASideLeavingBlankView *leavingBlankView = [BBASideLeavingBlankView addToParentView:self.view];
[leavingBlankView addReceiver:self.tableView];
}
```
*/
@interface BBASideLeavingBlankView : UIView
/// 添加留白区域事件接收者,可以添加多个,会根据view的纵向区域区分
- (void)addReceiver:(UIView *)view;
/// 添加到父视图上
+ (BBASideLeavingBlankView *)addToParentView:(UIView *)view;
@end
NS_ASSUME_NONNULL_END