Sfoglia il codice sorgente

1.通知内容过多可以滚动显示

huangxiaodong 1 anno fa
parent
commit
68dd908d57

+ 43 - 9
创维盒子/双子星云手机/Class/Set/appUpdate/HaveNoticeView.m

@@ -53,16 +53,20 @@ static HaveNoticeView * _instance;
     self.tag = 111112;
     [self setBackgroundColor:HW000000Color60];
     
+    BOOL isNeedScroll = NO;
+    
     NSString *titleStr = _curNoticeModel.data.title;
     NSString *contentStr = _curNoticeModel.data.content;
     
     CGFloat curHeight = [contentStr boundingRectWithSize:CGSizeMake(300 -40, 1000) options:(NSStringDrawingUsesLineFragmentOrigin) attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:14.0]} context:nil].size.height;
+    CGFloat fullHeight = curHeight + 20;
     
     curHeight += 10;
     
-    if( (curHeight + 200) >= SCREEN_H){
+    if( (curHeight + 200 +100) >= SCREEN_H){
         
-        curHeight = SCREEN_H - 200 - 10;
+        curHeight = SCREEN_H - 200 - 150;
+        isNeedScroll = YES;
     }
     
     _bgView = [[UIView alloc] init];
@@ -111,13 +115,43 @@ static HaveNoticeView * _instance;
     [tipsLabel setFont:[UIFont systemFontOfSize:14.f]];
     //[tipsLabel setTextAlignment:(NSTextAlignmentCenter)];
     [tipsLabel setNumberOfLines:0];
-    [_bgView addSubview:tipsLabel];
-    [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.top.equalTo(titleLabel.mas_bottom).offset(20.f);
-        make.left.mas_equalTo(20);
-        make.right.mas_equalTo(-20);
-        make.height.mas_equalTo(curHeight);
-    }];
+    //tipsLabel.backgroundColor = [UIColor redColor];
+    
+    //可能文字超出
+    UIScrollView *bgScorllV = [[UIScrollView alloc] init];
+    //bgScorllV.showsHorizontalScrollIndicator = NO;
+    //bgScorllV.backgroundColor = [UIColor greenColor];
+    if(isNeedScroll){
+        
+        [_bgView addSubview:bgScorllV];
+        [bgScorllV mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.top.equalTo(titleLabel.mas_bottom).offset(20.f);
+            make.left.mas_equalTo(0);
+            make.right.mas_equalTo(0);
+            make.height.mas_equalTo(curHeight);
+        }];
+        
+        [bgScorllV addSubview:tipsLabel];
+        [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.top.mas_equalTo(0);
+            make.left.mas_equalTo(20);
+            //make.right.mas_equalTo(-20);
+            make.width.mas_equalTo(260);
+            make.height.mas_equalTo(fullHeight);
+        }];
+        
+        bgScorllV.contentSize = CGSizeMake(300, fullHeight);
+    }
+    else{
+        [_bgView addSubview:tipsLabel];
+        [tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) {
+            make.top.equalTo(titleLabel.mas_bottom).offset(20.f);
+            make.left.mas_equalTo(20);
+            make.right.mas_equalTo(-20);
+            make.height.mas_equalTo(curHeight);
+        }];
+    }
+    
     
    
     

File diff suppressed because it is too large
+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+otherDelegate.mm