From 2e82c7f03b0833e3a149d02453d66d8db133b2ce Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 29 十一月 2021 13:36:20 +0800
Subject: [PATCH] 2021-11-29 1.实现ON+设计的UI
---
HDLSceneSiriDemo/HDLSceneSiriDemo/HDLSceneSiri/HDLSiriSceneListCell.m | 58 ++++++++++++++++++++++++++++++++++++----------------------
1 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/HDLSceneSiriDemo/HDLSceneSiriDemo/HDLSceneSiri/HDLSiriSceneListCell.m b/HDLSceneSiriDemo/HDLSceneSiriDemo/HDLSceneSiri/HDLSiriSceneListCell.m
index 6640151..3400286 100644
--- a/HDLSceneSiriDemo/HDLSceneSiriDemo/HDLSceneSiri/HDLSiriSceneListCell.m
+++ b/HDLSceneSiriDemo/HDLSceneSiriDemo/HDLSceneSiri/HDLSiriSceneListCell.m
@@ -26,30 +26,39 @@
///
- (void)addAllChildView{
- self.backgroundColor = [UIColor clearColor];
- self.contentView.backgroundColor = [UIColor clearColor];
- [self.contentView addSubview:self.bgView];
- [self.bgView addSubview:self.titleLabel];
+ self.backgroundColor = [UIColor whiteColor];
+ self.contentView.backgroundColor = [UIColor whiteColor];
+// [self.contentView addSubview:self.bgView];
+ [self.contentView addSubview:self.titleLabel];
if (@available(iOS 12.0, *)) {
- [self.bgView addSubview:self.shortcutButton];
+ [self.contentView addSubview:self.shortcutButton];
}
+ [self.contentView addSubview:self.lineView];
}
--(UIView*)bgView{
- if(!_bgView){
- _bgView = [[UIView alloc]initWithFrame:CGRectMake(20, 6, APP_SCREEN_WIDTH - 40, 60)];
- _bgView.backgroundColor = UIColor.whiteColor;
- _bgView.layer.cornerRadius = 12;
- _bgView.layer.masksToBounds = YES;// 闅愯棌杈圭晫
+//-(UIView*)bgView{
+// if(!_bgView){
+// _bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, APP_SCREEN_WIDTH, 50)];
+// _bgView.backgroundColor = UIColor.whiteColor;
+//// _bgView.layer.cornerRadius = 12;
+//// _bgView.layer.masksToBounds = YES;// 闅愯棌杈圭晫
+// }
+// return _bgView;
+//}
+-(UIView*)lineView{
+ if(!_lineView){
+ _lineView = [[UIView alloc]initWithFrame:CGRectMake(16, 49, APP_SCREEN_WIDTH - 32, 1)];
+ _lineView.backgroundColor = HEXCOLORA(0xECEDEE , 1.0);
}
- return _bgView;
+ return _lineView;
}
+
-(UILabel*)titleLabel{
if(!_titleLabel){
- _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(6, 10, APP_SCREEN_WIDTH - 40 - 206, 40)];
+ _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(16, 0, APP_SCREEN_WIDTH - 32 - 180, 50)];
_titleLabel.textColor = COLOR_TEXT;
- _titleLabel.font = Get_FontMediumWithSize(16);
+ _titleLabel.font = Get_FontMediumWithSize(14);
_titleLabel.textAlignment = NSTextAlignmentLeft;
_titleLabel.numberOfLines = 2;
}
@@ -59,9 +68,10 @@
- (INUIAddVoiceShortcutButton*)shortcutButton{
if(!_shortcutButton){
_shortcutButton = [[INUIAddVoiceShortcutButton alloc] initWithStyle:INUIAddVoiceShortcutButtonStyleWhite];
+// _shortcutButton.backgroundColor = UIColor.redColor;
// _shortcutButton.shortcut = [[INShortcut alloc] initWithIntent:self.intent];
_shortcutButton.translatesAutoresizingMaskIntoConstraints = YES;
- _shortcutButton.frame = CGRectMake(APP_SCREEN_WIDTH - 40 - 150, 6, 150, 48);
+ _shortcutButton.frame = CGRectMake(APP_SCREEN_WIDTH - 160, 2, 160, 46);
[_shortcutButton setEnabled:NO];
// _shortcutButton.delegate = self;
}
@@ -76,25 +86,29 @@
// self.titleLabel.text = model.name;
//}
--(void)initModel:(HDLSiriSceneModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)){
+-(void)initModel:(HDLSiriControlModel *)model intent:(HDLRunSceneIntent*)intent API_AVAILABLE(ios(12.0)){
_model = model;
//鍒ょ┖
if (_model == nil) return;
//澶勭悊model鏁版嵁
- self.titleLabel.text = model.name;
+ self.titleLabel.text = model.controlName;
if(intent == nil){
- _shortcutButton.shortcut = [self getINShortcut];
+ _shortcutButton.shortcut = [self getINShortcut:_model];
}else{
_shortcutButton.shortcut = [[INShortcut alloc] initWithIntent:intent];
}
}
-- (INShortcut *) getINShortcut API_AVAILABLE(ios(12.0)){
- NSString *title = _model.name;
+- (INShortcut *) getINShortcut:(HDLSiriControlModel*)sceneModel API_AVAILABLE(ios(12.0)){
+ NSString *title = sceneModel.controlName;
HDLRunSceneIntent *intent = [[HDLRunSceneIntent alloc] init];
- intent.sceneId = _model.userSceneId;
intent.suggestedInvocationPhrase = title; //鍦⊿iri璇煶璁剧疆鏃舵樉绀虹殑寤鸿璁剧疆鍞よ捣鏂囧瓧
- intent.sceneName = title;
+ intent.controlId = sceneModel.controlId;
+ intent.controlName = title;
+ intent.homeId = self.homeId;
+ intent.actionName =
+ intent.controlType = sceneModel.controlType;
+ intent.controlJSONStr = sceneModel.controlJSONStr;
INShortcut *shortCut = [[INShortcut alloc] initWithIntent:intent];
return shortCut;
}
--
Gitblit v1.8.0