Skip to content

Commit 7be537f

Browse files
Kennaki KaiKennaki Kai
authored andcommitted
Feat: Add panel module.
1 parent df362f8 commit 7be537f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1570
-0
lines changed

Example/.DS_Store

0 Bytes
Binary file not shown.

Example/TuyaSmartHomeKit.xcodeproj/project.pbxproj

Lines changed: 170 additions & 0 deletions
Large diffs are not rendered by default.

Example/TuyaSmartHomeKit/.DS_Store

0 Bytes
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//
2+
// TPBaseTableViewController.h
3+
// TYLibraryExample
4+
//
5+
// Created by XuChengcheng on 2017/4/11.
6+
// Copyright © 2017年 Tuya. All rights reserved.
7+
//
8+
9+
#import "TPBaseViewController.h"
10+
11+
@class MJRefreshHeader;
12+
13+
@interface TPBaseTableViewController : TPBaseViewController <UITableViewDataSource,UITableViewDelegate>
14+
15+
16+
@property (nonatomic, assign) UITableViewStyle tableViewStyle;
17+
@property (nonatomic, strong) UITableView *tableView;
18+
@property (nonatomic, strong) NSMutableArray *dataSource;
19+
20+
/**
21+
* 刷新数据
22+
*/
23+
- (void)reloadTable;
24+
25+
@end
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
//
2+
// TPBaseTableViewController.m
3+
// TYLibraryExample
4+
//
5+
// Created by XuChengcheng on 2017/4/11.
6+
// Copyright © 2017年 Tuya. All rights reserved.
7+
//
8+
9+
#import "TPBaseTableViewController.h"
10+
11+
@interface TPBaseTableViewController()
12+
13+
@end
14+
15+
@implementation TPBaseTableViewController
16+
17+
- (instancetype)init {
18+
if (self = [super init]) {
19+
_tableViewStyle = UITableViewStylePlain;
20+
}
21+
return self;
22+
}
23+
24+
/**
25+
* 子类先实现自己的,再[super viewDidLoad];
26+
*/
27+
- (void)viewDidLoad {
28+
29+
[super viewDidLoad];
30+
}
31+
32+
- (NSMutableArray *)dataSource {
33+
if (!_dataSource) {
34+
_dataSource = [NSMutableArray new];
35+
}
36+
return _dataSource;
37+
}
38+
39+
- (UITableView *)tableView
40+
{
41+
if (!_tableView)
42+
{
43+
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, APP_SCREEN_WIDTH, 0) style:self.tableViewStyle];
44+
_tableView.backgroundColor = HEXCOLOR(0xE8E9EF);
45+
_tableView.showsVerticalScrollIndicator = NO;
46+
_tableView.showsHorizontalScrollIndicator = NO;
47+
_tableView.separatorStyle = NO;
48+
_tableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
49+
_tableView.dataSource = self;
50+
_tableView.delegate = self;
51+
52+
}
53+
return _tableView;
54+
}
55+
56+
- (void)stopInfiniteAnimation {
57+
// [self.tableView.infiniteScrollingView stopAnimating];
58+
}
59+
60+
- (void)reloadTable {
61+
[self.tableView reloadData];
62+
}
63+
64+
#pragma mark - 子类继承
65+
66+
- (void)reload {
67+
}
68+
69+
- (void)loadMore {
70+
}
71+
72+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
73+
return 1;
74+
}
75+
76+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
77+
return 0;
78+
}
79+
80+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
81+
return nil;
82+
}
83+
84+
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
85+
86+
}
87+
88+
89+
@end
90+

Example/TuyaSmartHomeKit/Base/Controller/TYTabBarViewController.m

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#import "TPNavigationController.h"
1111
#import "TYLoginViewController.h"
1212
#import "TYDeviceListViewController.h"
13+
#import "TYSmartSceneViewController.h"
1314
#import "TYAddDeviceMenuViewController.h"
1415
#import "TYSmartHomeManager.h"
1516

@@ -18,9 +19,11 @@ @interface TYTabBarViewController() <UITabBarControllerDelegate>
1819
@property (nonatomic, strong) TPNavigationController *deviceListNavigationController;
1920
@property (nonatomic, strong) TPNavigationController *addDeviceNavigationController;
2021
@property (nonatomic, strong) TPNavigationController *loginNavigationController;
22+
@property (nonatomic, strong) TPNavigationController *sceneNavigationController;
2123

2224
@property (nonatomic, strong) UIViewController *addDeviceViewController;
2325
@property (nonatomic, strong) TYDeviceListViewController *deviceViewController;
26+
@property (nonatomic, strong) TYSmartSceneViewController *sceneViewController;
2427

2528
@end
2629

@@ -52,6 +55,7 @@ - (void)setupControllers {
5255
self.loginNavigationController,
5356
self.deviceListNavigationController,
5457
self.addDeviceNavigationController,
58+
self.sceneNavigationController
5559
];
5660
}
5761

@@ -104,6 +108,12 @@ - (TYDeviceListViewController *)deviceViewController {
104108
return _deviceViewController;
105109
}
106110

111+
- (TPNavigationController *)sceneNavigationController {
112+
if (!_sceneNavigationController) {
113+
_sceneNavigationController = [[TPNavigationController alloc] initWithRootViewController:self.sceneViewController];
114+
}
115+
return _sceneNavigationController;
116+
}
107117

108118
- (UIViewController *)addDeviceViewController {
109119
if (!_addDeviceViewController) {
@@ -116,6 +126,16 @@ - (UIViewController *)addDeviceViewController {
116126
return _addDeviceViewController;
117127
}
118128

129+
- (TYSmartSceneViewController *)sceneViewController {
130+
if (!_sceneViewController) {
131+
_sceneViewController = [[TYSmartSceneViewController alloc] init];
132+
_sceneViewController.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Scene"
133+
image:[UIImage imageNamed:@"ty_scene_gray"]
134+
selectedImage:[UIImage imageNamed:@"ty_scene_active"]];
135+
}
136+
return _sceneViewController;
137+
}
138+
119139
#pragma mark - UITabBarControllerDelegate
120140

121141
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// TYAddSceneViewController.h
3+
// TuyaSmartPublic
4+
//
5+
// Created by TuyaInc on 19/1/30.
6+
// Copyright © 2016年 Tuya. All rights reserved.
7+
//
8+
9+
#import "TPBaseTableViewController.h"
10+
11+
@class TuyaSmartSceneModel;
12+
13+
@interface TYAddSceneViewController : TPBaseTableViewController
14+
15+
@end

0 commit comments

Comments
 (0)