Commit 1d5064a8e3787dc74fd4befd8d353405590251a6
1 parent
cf9d0686
聊天室输入框
Showing
17 changed files
with
479 additions
and
34 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
| @@ -21,10 +21,12 @@ | @@ -21,10 +21,12 @@ | ||
| 21 | 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64FD1E779B1F00133E15 /* ViewController+MASAdditions.m */; }; | 21 | 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B64FD1E779B1F00133E15 /* ViewController+MASAdditions.m */; }; |
| 22 | 810B650A1E77B39D00133E15 /* LVCFullScreenPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */; }; | 22 | 810B650A1E77B39D00133E15 /* LVCFullScreenPlayerController.m in Sources */ = {isa = PBXBuildFile; fileRef = 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */; }; |
| 23 | 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */; }; | 23 | 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */; }; |
| 24 | + 811BB67A1E80F6F6005C6291 /* LVCChatView.m in Sources */ = {isa = PBXBuildFile; fileRef = 811BB6791E80F6F6005C6291 /* LVCChatView.m */; }; | ||
| 24 | 812E50531E7699DC004F5FCD /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; }; | 25 | 812E50531E7699DC004F5FCD /* CNLivePlayerSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; }; |
| 25 | 812E50551E7699E9004F5FCD /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; }; | 26 | 812E50551E7699E9004F5FCD /* CNLiveMsgTools.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; }; |
| 26 | 812E50561E7699E9004F5FCD /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | 27 | 812E50561E7699E9004F5FCD /* CNLiveMsgTools.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 27 | 812E50581E7699E9004F5FCD /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; | 28 | 812E50581E7699E9004F5FCD /* CNLivePlayerSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; |
| 29 | + 814FC9661E7FB62F00944D7D /* LVCInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = 814FC9651E7FB62F00944D7D /* LVCInputView.m */; }; | ||
| 28 | 81FB5B3C1E7A6FFC00F98E1D /* SevenSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */; }; | 30 | 81FB5B3C1E7A6FFC00F98E1D /* SevenSwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */; }; |
| 29 | D2029B861E6EAAA50027CD92 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029B851E6EAAA50027CD92 /* main.m */; }; | 31 | D2029B861E6EAAA50027CD92 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029B851E6EAAA50027CD92 /* main.m */; }; |
| 30 | D2029B911E6EAAA50027CD92 /* animation.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D2029B901E6EAAA50027CD92 /* animation.xcassets */; }; | 32 | D2029B911E6EAAA50027CD92 /* animation.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D2029B901E6EAAA50027CD92 /* animation.xcassets */; }; |
| @@ -221,9 +223,12 @@ | @@ -221,9 +223,12 @@ | ||
| 221 | 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCFullScreenPlayerController.m; sourceTree = "<group>"; }; | 223 | 810B65091E77B39D00133E15 /* LVCFullScreenPlayerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCFullScreenPlayerController.m; sourceTree = "<group>"; }; |
| 222 | 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCPlayerLoadingView.h; sourceTree = "<group>"; }; | 224 | 8112D42F1E7927A5002E00F6 /* LVCPlayerLoadingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCPlayerLoadingView.h; sourceTree = "<group>"; }; |
| 223 | 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCPlayerLoadingView.m; sourceTree = "<group>"; }; | 225 | 8112D4301E7927A5002E00F6 /* LVCPlayerLoadingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCPlayerLoadingView.m; sourceTree = "<group>"; }; |
| 226 | + 811BB6781E80F6F6005C6291 /* LVCChatView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCChatView.h; sourceTree = "<group>"; }; | ||
| 227 | + 811BB6791E80F6F6005C6291 /* LVCChatView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCChatView.m; sourceTree = "<group>"; }; | ||
| 224 | 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; }; | 228 | 812E504F1E7699DC004F5FCD /* CNLiveMsgTools.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLiveMsgTools.framework; sourceTree = "<group>"; }; |
| 225 | 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; }; | 229 | 812E50501E7699DC004F5FCD /* CNLivePlayerSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CNLivePlayerSDK.framework; sourceTree = "<group>"; }; |
| 226 | - 812E50511E7699DC004F5FCD /* KSYGPUResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = KSYGPUResource.bundle; sourceTree = "<group>"; }; | 230 | + 814FC9641E7FB62F00944D7D /* LVCInputView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LVCInputView.h; sourceTree = "<group>"; }; |
| 231 | + 814FC9651E7FB62F00944D7D /* LVCInputView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LVCInputView.m; sourceTree = "<group>"; }; | ||
| 227 | 81FB5B3A1E7A6FFC00F98E1D /* SevenSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SevenSwitch.h; sourceTree = "<group>"; }; | 232 | 81FB5B3A1E7A6FFC00F98E1D /* SevenSwitch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SevenSwitch.h; sourceTree = "<group>"; }; |
| 228 | 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SevenSwitch.m; sourceTree = "<group>"; }; | 233 | 81FB5B3B1E7A6FFC00F98E1D /* SevenSwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SevenSwitch.m; sourceTree = "<group>"; }; |
| 229 | D2029B811E6EAAA50027CD92 /* LiveVideoCloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LiveVideoCloud.app; sourceTree = BUILT_PRODUCTS_DIR; }; | 234 | D2029B811E6EAAA50027CD92 /* LiveVideoCloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = LiveVideoCloud.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
| @@ -574,6 +579,17 @@ | @@ -574,6 +579,17 @@ | ||
| 574 | path = CNLiveSDK; | 579 | path = CNLiveSDK; |
| 575 | sourceTree = "<group>"; | 580 | sourceTree = "<group>"; |
| 576 | }; | 581 | }; |
| 582 | + 814FC9531E7F6B5D00944D7D /* ChatView */ = { | ||
| 583 | + isa = PBXGroup; | ||
| 584 | + children = ( | ||
| 585 | + 814FC9641E7FB62F00944D7D /* LVCInputView.h */, | ||
| 586 | + 814FC9651E7FB62F00944D7D /* LVCInputView.m */, | ||
| 587 | + 811BB6781E80F6F6005C6291 /* LVCChatView.h */, | ||
| 588 | + 811BB6791E80F6F6005C6291 /* LVCChatView.m */, | ||
| 589 | + ); | ||
| 590 | + path = ChatView; | ||
| 591 | + sourceTree = "<group>"; | ||
| 592 | + }; | ||
| 577 | 81FB5B391E7A6FFC00F98E1D /* SevenSwitch */ = { | 593 | 81FB5B391E7A6FFC00F98E1D /* SevenSwitch */ = { |
| 578 | isa = PBXGroup; | 594 | isa = PBXGroup; |
| 579 | children = ( | 595 | children = ( |
| @@ -1375,6 +1391,7 @@ | @@ -1375,6 +1391,7 @@ | ||
| 1375 | D2888DA71E6EC014003A77C8 /* homeSections */ = { | 1391 | D2888DA71E6EC014003A77C8 /* homeSections */ = { |
| 1376 | isa = PBXGroup; | 1392 | isa = PBXGroup; |
| 1377 | children = ( | 1393 | children = ( |
| 1394 | + 814FC9531E7F6B5D00944D7D /* ChatView */, | ||
| 1378 | D2888DA81E6EC014003A77C8 /* Controller */, | 1395 | D2888DA81E6EC014003A77C8 /* Controller */, |
| 1379 | D2888DA91E6EC014003A77C8 /* Model */, | 1396 | D2888DA91E6EC014003A77C8 /* Model */, |
| 1380 | D2888DAA1E6EC014003A77C8 /* View */, | 1397 | D2888DAA1E6EC014003A77C8 /* View */, |
| @@ -1565,8 +1582,6 @@ | @@ -1565,8 +1582,6 @@ | ||
| 1565 | D2029CB01E6EADE10027CD92 /* MJRefresh.bundle in Resources */, | 1582 | D2029CB01E6EADE10027CD92 /* MJRefresh.bundle in Resources */, |
| 1566 | D2575C7C1E76A4F300E3A8FC /* NHFighterView.nib in Resources */, | 1583 | D2575C7C1E76A4F300E3A8FC /* NHFighterView.nib in Resources */, |
| 1567 | D25BF87D1E7B8C78007FB138 /* KSYGPUResource.bundle in Resources */, | 1584 | D25BF87D1E7B8C78007FB138 /* KSYGPUResource.bundle in Resources */, |
| 1568 | - D2029B8F1E6EAAA50027CD92 /* Main.storyboard in Resources */, | ||
| 1569 | - 812E50541E7699DC004F5FCD /* KSYGPUResource.bundle in Resources */, | ||
| 1570 | ); | 1585 | ); |
| 1571 | runOnlyForDeploymentPostprocessing = 0; | 1586 | runOnlyForDeploymentPostprocessing = 0; |
| 1572 | }; | 1587 | }; |
| @@ -1593,6 +1608,7 @@ | @@ -1593,6 +1608,7 @@ | ||
| 1593 | files = ( | 1608 | files = ( |
| 1594 | D2029CC31E6EADE10027CD92 /* UIImageView+HighlightedWebCache.m in Sources */, | 1609 | D2029CC31E6EADE10027CD92 /* UIImageView+HighlightedWebCache.m in Sources */, |
| 1595 | D22830FF1E77C69E00627701 /* GiftListView.m in Sources */, | 1610 | D22830FF1E77C69E00627701 /* GiftListView.m in Sources */, |
| 1611 | + 814FC9661E7FB62F00944D7D /* LVCInputView.m in Sources */, | ||
| 1596 | D2029CC01E6EADE10027CD92 /* UIImage+GIF.m in Sources */, | 1612 | D2029CC01E6EADE10027CD92 /* UIImage+GIF.m in Sources */, |
| 1597 | D2029BCF1E6EADD70027CD92 /* ZXTabBarController.m in Sources */, | 1613 | D2029BCF1E6EADD70027CD92 /* ZXTabBarController.m in Sources */, |
| 1598 | D2029D071E6EAE2E0027CD92 /* ZXConst.m in Sources */, | 1614 | D2029D071E6EAE2E0027CD92 /* ZXConst.m in Sources */, |
| @@ -1604,6 +1620,7 @@ | @@ -1604,6 +1620,7 @@ | ||
| 1604 | D2029CA01E6EADE10027CD92 /* NSObject+MJProperty.m in Sources */, | 1620 | D2029CA01E6EADE10027CD92 /* NSObject+MJProperty.m in Sources */, |
| 1605 | D2029CB51E6EADE10027CD92 /* SDiOSVersion.m in Sources */, | 1621 | D2029CB51E6EADE10027CD92 /* SDiOSVersion.m in Sources */, |
| 1606 | D2029C9C1E6EADE10027CD92 /* MJPropertyType.m in Sources */, | 1622 | D2029C9C1E6EADE10027CD92 /* MJPropertyType.m in Sources */, |
| 1623 | + 811BB67A1E80F6F6005C6291 /* LVCChatView.m in Sources */, | ||
| 1607 | D22831091E77D8D500627701 /* GiftModel.m in Sources */, | 1624 | D22831091E77D8D500627701 /* GiftModel.m in Sources */, |
| 1608 | D2029CCD1E6EADE10027CD92 /* SearchModel.m in Sources */, | 1625 | D2029CCD1E6EADE10027CD92 /* SearchModel.m in Sources */, |
| 1609 | 810B65051E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */, | 1626 | 810B65051E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */, |
LiveVideoCloud/LiveVideoCloud/Classes/CNLiveSDK/CNLivePlayerSDK.framework/Headers/CNLiveGPUStreamerKit.h
| @@ -275,13 +275,11 @@ FOUNDATION_EXPORT NSString *const CNLiveStreamStateDidChangeNotification NS_AVAI | @@ -275,13 +275,11 @@ FOUNDATION_EXPORT NSString *const CNLiveStreamStateDidChangeNotification NS_AVAI | ||
| 275 | 275 | ||
| 276 | /** | 276 | /** |
| 277 | @abstract 当前采集设备是否支持自动变焦 | 277 | @abstract 当前采集设备是否支持自动变焦 |
| 278 | - @param point相机对焦的位置 | ||
| 279 | */ | 278 | */ |
| 280 | - (void)focusAtPoint:(CGPoint )point; | 279 | - (void)focusAtPoint:(CGPoint )point; |
| 281 | 280 | ||
| 282 | /** | 281 | /** |
| 283 | @abstract 当前采集设备是否支持自动曝光 | 282 | @abstract 当前采集设备是否支持自动曝光 |
| 284 | - @param point相机曝光的位置 | ||
| 285 | */ | 283 | */ |
| 286 | - (void)exposureAtPoint:(CGPoint )point; | 284 | - (void)exposureAtPoint:(CGPoint )point; |
| 287 | 285 |
LiveVideoCloud/LiveVideoCloud/Classes/CNLiveSDK/CNLivePlayerSDK.framework/Headers/CNLiveWatermark.h
| @@ -15,7 +15,6 @@ | @@ -15,7 +15,6 @@ | ||
| 15 | @abstract 水印logo的图片 | 15 | @abstract 水印logo的图片 |
| 16 | @discussion 设置为nil为清除水印图片 | 16 | @discussion 设置为nil为清除水印图片 |
| 17 | @discussion 请注意背景图片的尺寸, 太大的图片会导致内存占用过高 | 17 | @discussion 请注意背景图片的尺寸, 太大的图片会导致内存占用过高 |
| 18 | - @see | ||
| 19 | */ | 18 | */ |
| 20 | @property (nonatomic, readwrite) UIImage *logoPic; | 19 | @property (nonatomic, readwrite) UIImage *logoPic; |
| 21 | 20 | ||
| @@ -23,7 +22,6 @@ | @@ -23,7 +22,6 @@ | ||
| 23 | @abstract 水印logo的图片(网络图片) | 22 | @abstract 水印logo的图片(网络图片) |
| 24 | @discussion 设置为nil为清除水印图片 | 23 | @discussion 设置为nil为清除水印图片 |
| 25 | @discussion 请注意背景图片的尺寸, 太大的图片会导致内存占用过高 | 24 | @discussion 请注意背景图片的尺寸, 太大的图片会导致内存占用过高 |
| 26 | - @see | ||
| 27 | */ | 25 | */ |
| 28 | @property (nonatomic, readwrite) NSURL *logoURL; | 26 | @property (nonatomic, readwrite) NSURL *logoURL; |
| 29 | 27 |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatView.h
0 → 100644
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCChatView.m
0 → 100644
| 1 | +// | ||
| 2 | +// LVCChatView.m | ||
| 3 | +// LiveVideoCloud | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 17/3/21. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "LVCChatView.h" | ||
| 10 | + | ||
| 11 | +@interface LVCChatView () | ||
| 12 | + | ||
| 13 | + | ||
| 14 | +@end | ||
| 15 | + | ||
| 16 | +@implementation LVCChatView | ||
| 17 | + | ||
| 18 | +- (instancetype)initWithFrame:(CGRect)frame | ||
| 19 | +{ | ||
| 20 | + self = [super initWithFrame:frame]; | ||
| 21 | + if (self) { | ||
| 22 | + | ||
| 23 | + } | ||
| 24 | + return self; | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | + | ||
| 28 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCInputView.h
0 → 100644
| 1 | +// | ||
| 2 | +// LVCInputView.h | ||
| 3 | +// LiveVideoCloud | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 17/3/20. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import <UIKit/UIKit.h> | ||
| 10 | + | ||
| 11 | +#define kSCREEN_HEIGHT [[UIScreen mainScreen] bounds].size.height //主屏幕的高度 | ||
| 12 | +#define kSCREEN_WIDTH [[UIScreen mainScreen] bounds].size.width //主屏幕的宽度 | ||
| 13 | + | ||
| 14 | +@class LVCInputView; | ||
| 15 | + | ||
| 16 | +@protocol LVCInputViewDelegate <NSObject> | ||
| 17 | + | ||
| 18 | +//发送文字 | ||
| 19 | +- (void)returnBtnClickedWithText:(NSString *)text; | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +@end | ||
| 23 | + | ||
| 24 | +@interface LVCInputView : UIView | ||
| 25 | +@property (nonatomic, strong) UILabel *placeholderLabel; | ||
| 26 | + | ||
| 27 | +@property (nonatomic, strong) UITextView *textView; | ||
| 28 | +@property (strong, nonatomic) UIButton *sendBtn; | ||
| 29 | +@property (assign, nonatomic) CGFloat keyboardHeight; | ||
| 30 | +@property (assign, nonatomic) CGFloat inputH; | ||
| 31 | +@property (assign, nonatomic) BOOL isEditing; | ||
| 32 | + | ||
| 33 | +@property (assign, nonatomic) BOOL isRecording; //正在编辑状态 | ||
| 34 | +@property (nonatomic, assign) id<LVCInputViewDelegate> delegate; | ||
| 35 | + | ||
| 36 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/ChatView/LVCInputView.m
0 → 100644
| 1 | +// | ||
| 2 | +// LVCInputView.m | ||
| 3 | +// LiveVideoCloud | ||
| 4 | +// | ||
| 5 | +// Created by iOS on 17/3/20. | ||
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | ||
| 7 | +// | ||
| 8 | + | ||
| 9 | +#import "LVCInputView.h" | ||
| 10 | + | ||
| 11 | +#define RGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:1.0] | ||
| 12 | +#define IMAGENAMED(NAME) [UIImage imageNamed:NAME] | ||
| 13 | + | ||
| 14 | +@interface LVCInputView ()<UITextViewDelegate> | ||
| 15 | + | ||
| 16 | +@property (nonatomic, strong) UIView *backGroundView; | ||
| 17 | +@property (assign, nonatomic) CGFloat currentTextViewH; | ||
| 18 | + | ||
| 19 | +@end | ||
| 20 | + | ||
| 21 | +@implementation LVCInputView | ||
| 22 | + | ||
| 23 | +- (instancetype)initWithFrame:(CGRect)frame{ | ||
| 24 | + self = [super initWithFrame:frame]; | ||
| 25 | + if (self) { | ||
| 26 | + self.inputH = 49; | ||
| 27 | + self.keyboardHeight = 0; | ||
| 28 | + self.backgroundColor = [UIColor whiteColor]; | ||
| 29 | + | ||
| 30 | + [self addSubview:self.backGroundView]; | ||
| 31 | + [self.backGroundView addSubview:self.textView]; | ||
| 32 | + [self.backGroundView addSubview:self.sendBtn]; | ||
| 33 | + [self.textView addSubview:self.placeholderLabel]; | ||
| 34 | + | ||
| 35 | + //增加监听,当键盘出现或改变时收出消息 | ||
| 36 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:)name:UIKeyboardWillShowNotification object:nil]; | ||
| 37 | + //增加监听,当键退出时收出消息 | ||
| 38 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:)name:UIKeyboardWillHideNotification | ||
| 39 | + object:nil]; | ||
| 40 | + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardDidShow)name:UIKeyboardDidShowNotification | ||
| 41 | + object:nil]; | ||
| 42 | + | ||
| 43 | + [self setUI]; | ||
| 44 | + | ||
| 45 | + } | ||
| 46 | + return self; | ||
| 47 | +} | ||
| 48 | +#pragma mark - 录音按钮点击 | ||
| 49 | +- (void)sendBtnClick:(UIButton *)sender { | ||
| 50 | + | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +#pragma mark - 键盘各种状态 | ||
| 54 | +//当键盘出现 | ||
| 55 | +- (void)keyboardWillShow:(NSNotification *)aNotification{ | ||
| 56 | + //获取键盘的高度 | ||
| 57 | + self.isEditing = YES; | ||
| 58 | + NSValue *aValue = [[aNotification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey]; | ||
| 59 | + CGRect keyboardRect = [aValue CGRectValue]; | ||
| 60 | + if (keyboardRect.size.height > self.keyboardHeight) { | ||
| 61 | + self.keyboardHeight = keyboardRect.size.height; | ||
| 62 | + } | ||
| 63 | + self.frame = CGRectMake(0, kSCREEN_HEIGHT - self.keyboardHeight - self.inputH, kSCREEN_WIDTH, self.inputH + self.keyboardHeight); | ||
| 64 | + self.backGroundView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, self.inputH); | ||
| 65 | + | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +- (void)keyboardWillHide:(NSNotification *)aNotification{ | ||
| 69 | + self.isEditing = NO; | ||
| 70 | + self.frame = CGRectMake(0, kSCREEN_HEIGHT - self.inputH, kSCREEN_WIDTH, self.inputH) ; | ||
| 71 | +} | ||
| 72 | +- (void)keyboardDidShow { | ||
| 73 | + self.isEditing = YES; | ||
| 74 | +} | ||
| 75 | +#pragma mark - UITextViewDelegate | ||
| 76 | +- (void)textViewDidChange:(UITextView *)textView{ | ||
| 77 | + self.placeholderLabel.text = textView.text.length == 0 ? @"说点什么吧...":@""; | ||
| 78 | + //---- 计算高度 ---- // | ||
| 79 | + NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:[UIFont systemFontOfSize:16],NSFontAttributeName, nil]; | ||
| 80 | + CGFloat curheight = [textView.text boundingRectWithSize:CGSizeMake(kSCREEN_WIDTH-110, CGFLOAT_MAX) | ||
| 81 | + options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic | ||
| 82 | + context:nil].size.height; | ||
| 83 | + self.inputH = textView.contentSize.height + 12; | ||
| 84 | + if (self.currentTextViewH != curheight && curheight < 80) { | ||
| 85 | + self.currentTextViewH = curheight; | ||
| 86 | + NSString *offset = [NSString stringWithFormat:@"%f",self.keyboardHeight + self.inputH]; | ||
| 87 | + [[NSNotificationCenter defaultCenter]postNotificationName:@"textInputFrameChange" object:nil userInfo:@{@"offset":offset}]; | ||
| 88 | + } | ||
| 89 | + if (curheight < 19.094) { //一行 | ||
| 90 | + self.backGroundView.frame = CGRectMake(0,0 , kSCREEN_WIDTH, 49);//y - 49 | ||
| 91 | + }else if(curheight < 80){ //多行 | ||
| 92 | + self.backGroundView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, self.inputH); | ||
| 93 | + }else{ | ||
| 94 | + return; | ||
| 95 | + } | ||
| 96 | + self.frame = CGRectMake(0, kSCREEN_HEIGHT - self.keyboardHeight - self.inputH, kSCREEN_WIDTH,self.inputH + self.keyboardHeight ); | ||
| 97 | +} | ||
| 98 | + | ||
| 99 | +#pragma mark - 发送按钮 回车 | ||
| 100 | +- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text{ | ||
| 101 | + if ([text isEqualToString:@"\n"]){ //判断输入的字是否是回车,即按下return | ||
| 102 | + if ([self.delegate respondsToSelector:@selector(returnBtnClickedWithText:)]) { | ||
| 103 | + [self.delegate returnBtnClickedWithText:self.textView.text]; | ||
| 104 | + } | ||
| 105 | + self.inputH = 49; | ||
| 106 | + self.textView.text = @""; | ||
| 107 | + self.placeholderLabel.text = @"说点什么吧..."; | ||
| 108 | + self.frame = CGRectMake(0, kSCREEN_HEIGHT-self.inputH-self.keyboardHeight, kSCREEN_WIDTH, self.inputH+self.keyboardHeight); | ||
| 109 | + self.backGroundView.frame = CGRectMake(0, 0, kSCREEN_WIDTH, self.inputH); | ||
| 110 | + NSString *offset = [NSString stringWithFormat:@"%f",self.keyboardHeight + self.inputH]; | ||
| 111 | + [[NSNotificationCenter defaultCenter]postNotificationName:@"textInputFrameChange" object:nil userInfo:@{@"offset":offset}]; | ||
| 112 | + return NO; //这里返回NO,就代表return键值失效,即页面上按下return,不会出现换行,如果为yes,则输入 | ||
| 113 | + } | ||
| 114 | + return YES; | ||
| 115 | +} | ||
| 116 | + | ||
| 117 | + | ||
| 118 | +#pragma mark - UI | ||
| 119 | + | ||
| 120 | +- (void)setUI{ | ||
| 121 | + | ||
| 122 | + [self.backGroundView mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 123 | + make.edges.mas_offset(UIEdgeInsetsMake(0, 0, 0, 0)); | ||
| 124 | + }]; | ||
| 125 | + | ||
| 126 | + [self.textView mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 127 | + make.top.mas_equalTo(6); | ||
| 128 | + make.left.mas_offset(10); | ||
| 129 | + make.bottom.equalTo(self.backGroundView.mas_bottom).offset(-6); | ||
| 130 | + make.right.equalTo(self.backGroundView).offset(-50); | ||
| 131 | + }]; | ||
| 132 | + | ||
| 133 | + [self.sendBtn mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 134 | + make.left.equalTo(self.textView.mas_right).offset(10); | ||
| 135 | + make.centerY.equalTo(self.backGroundView.mas_centerY); | ||
| 136 | + make.width.height.mas_equalTo(30); | ||
| 137 | + }]; | ||
| 138 | + | ||
| 139 | + [self.placeholderLabel mas_makeConstraints:^(MASConstraintMaker *make) { | ||
| 140 | + make.top.mas_equalTo(0); | ||
| 141 | + make.left.equalTo(self.textView.mas_left).offset(8); | ||
| 142 | + make.height.mas_equalTo(39); | ||
| 143 | + }]; | ||
| 144 | +} | ||
| 145 | + | ||
| 146 | +#pragma mark - 懒加载控件 | ||
| 147 | +- (UIView *)backGroundView{ | ||
| 148 | + if (!_backGroundView) { | ||
| 149 | + _backGroundView = [[UIView alloc]init]; | ||
| 150 | + _backGroundView.backgroundColor = RGB(0xf6f6f6); | ||
| 151 | + } | ||
| 152 | + return _backGroundView; | ||
| 153 | +} | ||
| 154 | +- (UITextView *)textView{ | ||
| 155 | + if (!_textView) { | ||
| 156 | + _textView = [[UITextView alloc]init]; | ||
| 157 | + _textView.font = [UIFont systemFontOfSize:16]; | ||
| 158 | + _textView.delegate = self; | ||
| 159 | + _textView.layer.cornerRadius = 5; | ||
| 160 | + _textView.returnKeyType = UIReturnKeySend; | ||
| 161 | + } | ||
| 162 | + return _textView; | ||
| 163 | +} | ||
| 164 | + | ||
| 165 | +- (UILabel *)placeholderLabel{ | ||
| 166 | + if (!_placeholderLabel) { | ||
| 167 | + _placeholderLabel = [[UILabel alloc]init]; | ||
| 168 | + _placeholderLabel.text = @"说点什么吧..."; | ||
| 169 | + _placeholderLabel.textColor = RGB(0x999999); | ||
| 170 | + _placeholderLabel.font = [UIFont systemFontOfSize:14]; | ||
| 171 | + } | ||
| 172 | + return _placeholderLabel; | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +- (UIButton *)sendBtn { | ||
| 176 | + if (_sendBtn == nil) { | ||
| 177 | + _sendBtn = [[UIButton alloc]init]; | ||
| 178 | + _sendBtn.titleLabel.textColor = RGB(0x666666); | ||
| 179 | + _sendBtn.titleLabel.font = [UIFont systemFontOfSize:14]; | ||
| 180 | + [_sendBtn setImage:IMAGENAMED(@"send") forState:UIControlStateNormal]; | ||
| 181 | + [_sendBtn addTarget:self action:@selector(sendBtnClick:) forControlEvents:UIControlEventTouchUpInside]; | ||
| 182 | + } | ||
| 183 | + return _sendBtn; | ||
| 184 | +} | ||
| 185 | + | ||
| 186 | +/* | ||
| 187 | +// Only override drawRect: if you perform custom drawing. | ||
| 188 | +// An empty implementation adversely affects performance during animation. | ||
| 189 | +- (void)drawRect:(CGRect)rect { | ||
| 190 | + // Drawing code | ||
| 191 | +} | ||
| 192 | +*/ | ||
| 193 | + | ||
| 194 | +@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCFullScreenPlayerController.m
| @@ -33,7 +33,11 @@ | @@ -33,7 +33,11 @@ | ||
| 33 | - (void)viewDidLoad { | 33 | - (void)viewDidLoad { |
| 34 | [super viewDidLoad]; | 34 | [super viewDidLoad]; |
| 35 | self.view.backgroundColor = [UIColor blackColor]; | 35 | self.view.backgroundColor = [UIColor blackColor]; |
| 36 | +} | ||
| 36 | 37 | ||
| 38 | +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event | ||
| 39 | +{ | ||
| 40 | + [self.view endEditing:YES]; | ||
| 37 | } | 41 | } |
| 38 | 42 | ||
| 39 | - (void)didReceiveMemoryWarning { | 43 | - (void)didReceiveMemoryWarning { |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/Controller/LVCLivePlayerController.m
| @@ -9,21 +9,23 @@ | @@ -9,21 +9,23 @@ | ||
| 9 | #import "LVCLivePlayerController.h" | 9 | #import "LVCLivePlayerController.h" |
| 10 | #import "LVCPlayer.h" | 10 | #import "LVCPlayer.h" |
| 11 | #import "LVCFullScreenPlayerController.h" | 11 | #import "LVCFullScreenPlayerController.h" |
| 12 | +#import "LVCInputView.h" | ||
| 12 | 13 | ||
| 13 | #define WIDTH_SCREEN [UIScreen mainScreen].bounds.size.width | 14 | #define WIDTH_SCREEN [UIScreen mainScreen].bounds.size.width |
| 14 | #define HEIGHT_SCREEN [UIScreen mainScreen].bounds.size.height | 15 | #define HEIGHT_SCREEN [UIScreen mainScreen].bounds.size.height |
| 15 | 16 | ||
| 16 | -@interface LVCLivePlayerController ()<LVCPlayerDelegate> | 17 | +@interface LVCLivePlayerController ()<LVCPlayerDelegate,LVCInputViewDelegate> |
| 17 | { | 18 | { |
| 18 | BOOL isHiddenStatusBar; //记录状态的隐藏显示 | 19 | BOOL isHiddenStatusBar; //记录状态的隐藏显示 |
| 19 | CGRect playerFrame; // | 20 | CGRect playerFrame; // |
| 20 | NSInteger _originalDirection; //记录原始方向 | 21 | NSInteger _originalDirection; //记录原始方向 |
| 21 | 22 | ||
| 22 | - | 23 | + CGFloat keyboardHeight; //键盘高度 |
| 24 | + | ||
| 23 | } | 25 | } |
| 24 | @property (nonatomic, strong) LVCPlayer *player; | 26 | @property (nonatomic, strong) LVCPlayer *player; |
| 25 | @property (nonatomic, strong) LVCFullScreenPlayerController *fullVC; | 27 | @property (nonatomic, strong) LVCFullScreenPlayerController *fullVC; |
| 26 | - | 28 | +@property (nonatomic, strong) LVCInputView *inputView; |
| 27 | @end | 29 | @end |
| 28 | 30 | ||
| 29 | @implementation LVCLivePlayerController | 31 | @implementation LVCLivePlayerController |
| @@ -44,15 +46,16 @@ | @@ -44,15 +46,16 @@ | ||
| 44 | - (void)viewDidLoad { | 46 | - (void)viewDidLoad { |
| 45 | [super viewDidLoad]; | 47 | [super viewDidLoad]; |
| 46 | 48 | ||
| 47 | - self.view.backgroundColor = [UIColor whiteColor]; | 49 | + self.view.backgroundColor = [UIColor blackColor]; |
| 48 | 50 | ||
| 49 | - playerFrame = CGRectMake(0, 0,WIDTH_SCREEN, WIDTH_SCREEN*9/16); | 51 | + playerFrame = CGRectMake(0, 20,WIDTH_SCREEN, WIDTH_SCREEN*9/16); |
| 50 | _originalDirection = 0; | 52 | _originalDirection = 0; |
| 51 | 53 | ||
| 52 | //注册通知 | 54 | //注册通知 |
| 53 | [self addObservers]; | 55 | [self addObservers]; |
| 54 | 56 | ||
| 55 | [self.view addSubview:self.player]; | 57 | [self.view addSubview:self.player]; |
| 58 | + [self.view addSubview:self.inputView]; | ||
| 56 | 59 | ||
| 57 | [self makeConstraints]; | 60 | [self makeConstraints]; |
| 58 | } | 61 | } |
| @@ -63,8 +66,7 @@ | @@ -63,8 +66,7 @@ | ||
| 63 | selector:@selector(onDeviceOrientationChange:) | 66 | selector:@selector(onDeviceOrientationChange:) |
| 64 | name:UIDeviceOrientationDidChangeNotification | 67 | name:UIDeviceOrientationDidChangeNotification |
| 65 | object:nil]; | 68 | object:nil]; |
| 66 | - | ||
| 67 | - | 69 | + |
| 68 | } | 70 | } |
| 69 | 71 | ||
| 70 | #pragma mark - | 72 | #pragma mark - |
| @@ -84,7 +86,6 @@ | @@ -84,7 +86,6 @@ | ||
| 84 | [self toHalfScreenWithrotationAngle:-M_PI_2]; | 86 | [self toHalfScreenWithrotationAngle:-M_PI_2]; |
| 85 | } | 87 | } |
| 86 | _originalDirection = 0; | 88 | _originalDirection = 0; |
| 87 | - _player.isFullScreen = NO; | ||
| 88 | } | 89 | } |
| 89 | break; | 90 | break; |
| 90 | 91 | ||
| @@ -114,29 +115,38 @@ | @@ -114,29 +115,38 @@ | ||
| 114 | //旋转至全屏 | 115 | //旋转至全屏 |
| 115 | - (void)toFullWithrotationAngle:(CGFloat)angle | 116 | - (void)toFullWithrotationAngle:(CGFloat)angle |
| 116 | { | 117 | { |
| 117 | - if (self.player.isFullScreen) return; | ||
| 118 | - | 118 | + if (_player.isFullScreen) return; |
| 119 | + | ||
| 120 | + _player.isFullScreen = YES; | ||
| 121 | + | ||
| 119 | [self presentViewController:self.fullVC animated:NO completion:^{ | 122 | [self presentViewController:self.fullVC animated:NO completion:^{ |
| 120 | [_player removeFromSuperview]; | 123 | [_player removeFromSuperview]; |
| 121 | [self.fullVC.view addSubview:self.player]; | 124 | [self.fullVC.view addSubview:self.player]; |
| 125 | + [_inputView removeFromSuperview]; | ||
| 126 | + [self.fullVC.view addSubview:self.inputView]; | ||
| 122 | [self makePlayerViewConstraints:YES]; | 127 | [self makePlayerViewConstraints:YES]; |
| 128 | + | ||
| 123 | self.player.transform = CGAffineTransformMakeRotation(angle); | 129 | self.player.transform = CGAffineTransformMakeRotation(angle); |
| 124 | [UIView animateWithDuration:0.3 animations:^{ | 130 | [UIView animateWithDuration:0.3 animations:^{ |
| 125 | self.player.transform = CGAffineTransformMakeRotation(0); | 131 | self.player.transform = CGAffineTransformMakeRotation(0); |
| 126 | }]; | 132 | }]; |
| 127 | }]; | 133 | }]; |
| 128 | 134 | ||
| 129 | - self.player.isFullScreen = YES; | ||
| 130 | 135 | ||
| 131 | } | 136 | } |
| 132 | 137 | ||
| 133 | //旋转至半屏 | 138 | //旋转至半屏 |
| 134 | - (void)toHalfScreenWithrotationAngle:(CGFloat)angle | 139 | - (void)toHalfScreenWithrotationAngle:(CGFloat)angle |
| 135 | { | 140 | { |
| 141 | + _player.isFullScreen = NO; | ||
| 142 | + | ||
| 136 | [_fullVC dismissViewControllerAnimated:NO completion:^{ | 143 | [_fullVC dismissViewControllerAnimated:NO completion:^{ |
| 137 | [_player removeFromSuperview]; | 144 | [_player removeFromSuperview]; |
| 138 | [self.view addSubview:self.player]; | 145 | [self.view addSubview:self.player]; |
| 146 | + [self.inputView removeFromSuperview]; | ||
| 147 | + [self.view addSubview:self.inputView]; | ||
| 139 | [self makePlayerViewConstraints:NO]; | 148 | [self makePlayerViewConstraints:NO]; |
| 149 | + | ||
| 140 | self.player.transform = CGAffineTransformMakeRotation(angle); | 150 | self.player.transform = CGAffineTransformMakeRotation(angle); |
| 141 | [UIView animateWithDuration:0.3 animations:^{ | 151 | [UIView animateWithDuration:0.3 animations:^{ |
| 142 | self.player.transform = CGAffineTransformMakeRotation(0); | 152 | self.player.transform = CGAffineTransformMakeRotation(0); |
| @@ -149,7 +159,7 @@ | @@ -149,7 +159,7 @@ | ||
| 149 | - (void)lvcPlayer:(LVCPlayer *)player clickedBackBtn:(UIButton *)backBtn | 159 | - (void)lvcPlayer:(LVCPlayer *)player clickedBackBtn:(UIButton *)backBtn |
| 150 | { | 160 | { |
| 151 | //如果是全屏返回半屏,如果是半屏直接退出 | 161 | //如果是全屏返回半屏,如果是半屏直接退出 |
| 152 | - if (self.player.isFullScreen) { | 162 | + if (_player.isFullScreen) { |
| 153 | [self toHalfScreenWithrotationAngle:M_PI_2]; | 163 | [self toHalfScreenWithrotationAngle:M_PI_2]; |
| 154 | self.player.isFullScreen = NO; | 164 | self.player.isFullScreen = NO; |
| 155 | } else { | 165 | } else { |
| @@ -161,7 +171,7 @@ | @@ -161,7 +171,7 @@ | ||
| 161 | 171 | ||
| 162 | - (void)lvcPlayer:(LVCPlayer *)player clickedFullScreenBtn:(UIButton *)fullScreenBtn | 172 | - (void)lvcPlayer:(LVCPlayer *)player clickedFullScreenBtn:(UIButton *)fullScreenBtn |
| 163 | { | 173 | { |
| 164 | - if (self.player.isFullScreen == YES) {//全屏 | 174 | + if (_player.isFullScreen) {//全屏 |
| 165 | [self toHalfScreenWithrotationAngle:M_PI_2]; | 175 | [self toHalfScreenWithrotationAngle:M_PI_2]; |
| 166 | self.player.isFullScreen = NO; | 176 | self.player.isFullScreen = NO; |
| 167 | 177 | ||
| @@ -172,7 +182,24 @@ | @@ -172,7 +182,24 @@ | ||
| 172 | 182 | ||
| 173 | - (void)lvcPlayer:(LVCPlayer *)player clickedEditBtn:(UIButton *)editBtn | 183 | - (void)lvcPlayer:(LVCPlayer *)player clickedEditBtn:(UIButton *)editBtn |
| 174 | { | 184 | { |
| 175 | - NSLog(@"开始编辑~~~~"); | 185 | + |
| 186 | +} | ||
| 187 | + | ||
| 188 | +#pragma mark - | ||
| 189 | +#pragma mark - LVCInputViewDelegate | ||
| 190 | +- (void)lvcInputView:(LVCInputView *)inputView sendWithText:(NSString *)text | ||
| 191 | +{ | ||
| 192 | + NSLog(@"发送消息-------%@",text); | ||
| 193 | +} | ||
| 194 | + | ||
| 195 | +- (void)lvcInputView:(LVCInputView *)inputView emojiBtnClicked:(UIButton *)emojiBtn | ||
| 196 | +{ | ||
| 197 | + | ||
| 198 | +} | ||
| 199 | + | ||
| 200 | +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event | ||
| 201 | +{ | ||
| 202 | + [self.view endEditing:YES]; | ||
| 176 | } | 203 | } |
| 177 | 204 | ||
| 178 | #pragma mark - | 205 | #pragma mark - |
| @@ -180,23 +207,35 @@ | @@ -180,23 +207,35 @@ | ||
| 180 | - (void)makeConstraints | 207 | - (void)makeConstraints |
| 181 | { | 208 | { |
| 182 | [self.player mas_makeConstraints:^(MASConstraintMaker *make) { | 209 | [self.player mas_makeConstraints:^(MASConstraintMaker *make) { |
| 183 | - make.top.left.right.mas_equalTo(0); | 210 | + make.top.mas_equalTo(20); |
| 211 | + make.left.right.mas_equalTo(0); | ||
| 184 | make.height.equalTo(@(playerFrame.size.height)); | 212 | make.height.equalTo(@(playerFrame.size.height)); |
| 185 | }]; | 213 | }]; |
| 214 | + | ||
| 215 | + _inputView.frame = CGRectMake(0, kSCREEN_HEIGHT-50, kSCREEN_WIDTH, 49); | ||
| 216 | + | ||
| 186 | } | 217 | } |
| 187 | 218 | ||
| 188 | - (void)makePlayerViewConstraints:(BOOL)fullScreen | 219 | - (void)makePlayerViewConstraints:(BOOL)fullScreen |
| 189 | { | 220 | { |
| 190 | - if (fullScreen) { | 221 | + if (fullScreen) { //全屏 |
| 222 | + | ||
| 191 | [self.player mas_remakeConstraints:^(MASConstraintMaker *make) { | 223 | [self.player mas_remakeConstraints:^(MASConstraintMaker *make) { |
| 192 | make.top.left.right.bottom.mas_equalTo(0); | 224 | make.top.left.right.bottom.mas_equalTo(0); |
| 193 | }]; | 225 | }]; |
| 194 | 226 | ||
| 195 | - } else { | 227 | + _inputView.frame = CGRectMake(0, kSCREEN_HEIGHT-50, kSCREEN_WIDTH, 49); |
| 228 | + | ||
| 229 | + } else { //半屏 | ||
| 230 | + | ||
| 196 | [self.player mas_remakeConstraints:^(MASConstraintMaker *make) { | 231 | [self.player mas_remakeConstraints:^(MASConstraintMaker *make) { |
| 197 | - make.top.left.right.mas_equalTo(0); | 232 | + make.top.mas_equalTo(20); |
| 233 | + make.left.right.mas_equalTo(0); | ||
| 198 | make.height.equalTo(@(playerFrame.size.height)); | 234 | make.height.equalTo(@(playerFrame.size.height)); |
| 199 | }]; | 235 | }]; |
| 236 | + | ||
| 237 | + _inputView.frame = CGRectMake(0, kSCREEN_HEIGHT-50, kSCREEN_WIDTH, 49); | ||
| 238 | + | ||
| 200 | } | 239 | } |
| 201 | } | 240 | } |
| 202 | 241 | ||
| @@ -218,6 +257,18 @@ | @@ -218,6 +257,18 @@ | ||
| 218 | } | 257 | } |
| 219 | return _fullVC; | 258 | return _fullVC; |
| 220 | } | 259 | } |
| 260 | + | ||
| 261 | +- (LVCInputView *)inputView | ||
| 262 | +{ | ||
| 263 | + if (!_inputView) { | ||
| 264 | + _inputView = [[LVCInputView alloc]init]; | ||
| 265 | + _inputView.delegate = self; | ||
| 266 | + } | ||
| 267 | + return _inputView; | ||
| 268 | +} | ||
| 269 | + | ||
| 270 | + | ||
| 271 | + | ||
| 221 | - (void)didReceiveMemoryWarning { | 272 | - (void)didReceiveMemoryWarning { |
| 222 | [super didReceiveMemoryWarning]; | 273 | [super didReceiveMemoryWarning]; |
| 223 | // Dispose of any resources that can be recreated. | 274 | // Dispose of any resources that can be recreated. |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayer.h
| @@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
| 27 | 27 | ||
| 28 | @property (nonatomic, strong) UIImageView *contentView; //所有空间统一管理在这个view中 | 28 | @property (nonatomic, strong) UIImageView *contentView; //所有空间统一管理在这个view中 |
| 29 | @property (nonatomic, strong) UIButton *backBtn; //返回 | 29 | @property (nonatomic, strong) UIButton *backBtn; //返回 |
| 30 | -@property (nonatomic, assign) BOOL isFullScreen; //是否是全屏 | 30 | +@property (nonatomic, readwrite, assign) BOOL isFullScreen; //是否是全屏 |
| 31 | 31 | ||
| 32 | - (void)stopPlaying; | 32 | - (void)stopPlaying; |
| 33 | 33 |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/homeSections/View/LVCPlayer.m
| @@ -14,10 +14,8 @@ | @@ -14,10 +14,8 @@ | ||
| 14 | #define kAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94" | 14 | #define kAppKey @"69fe70bda67e059286ad509d9f5377f815955645b52f94" |
| 15 | #define kbundleId @"com.cnlive.zhangxu.LiveVideoCloud" | 15 | #define kbundleId @"com.cnlive.zhangxu.LiveVideoCloud" |
| 16 | 16 | ||
| 17 | -@interface LVCPlayer () | ||
| 18 | -{ | ||
| 19 | - BOOL _isFull; | ||
| 20 | -} | 17 | +@interface LVCPlayer ()<UIGestureRecognizerDelegate> |
| 18 | + | ||
| 21 | @property (nonatomic, strong) UIImageView *topBgView; //顶部蒙版 | 19 | @property (nonatomic, strong) UIImageView *topBgView; //顶部蒙版 |
| 22 | @property (nonatomic, strong) UIImageView *bottomBgView; //底部蒙版 | 20 | @property (nonatomic, strong) UIImageView *bottomBgView; //底部蒙版 |
| 23 | @property (nonatomic, strong) UIButton *playOrPauseBtn; //播放/暂停 | 21 | @property (nonatomic, strong) UIButton *playOrPauseBtn; //播放/暂停 |
| @@ -117,7 +115,10 @@ | @@ -117,7 +115,10 @@ | ||
| 117 | self.bottomBgView.alpha = self.bottomBgView.alpha == 0 ? 1 : 0; | 115 | self.bottomBgView.alpha = self.bottomBgView.alpha == 0 ? 1 : 0; |
| 118 | self.editBtn.alpha = self.editBtn.alpha == 0 ? 1 : 0; | 116 | self.editBtn.alpha = self.editBtn.alpha == 0 ? 1 : 0; |
| 119 | }]; | 117 | }]; |
| 120 | - [[UIApplication sharedApplication] setStatusBarHidden:self.topBgView.alpha == 0 ? YES : NO withAnimation:UIStatusBarAnimationFade]; | 118 | + |
| 119 | + if (_isFullScreen) { | ||
| 120 | + [[UIApplication sharedApplication] setStatusBarHidden:self.topBgView.alpha == 0 ? YES : NO withAnimation:UIStatusBarAnimationFade]; | ||
| 121 | + } | ||
| 121 | 122 | ||
| 122 | } | 123 | } |
| 123 | 124 | ||
| @@ -135,6 +136,14 @@ | @@ -135,6 +136,14 @@ | ||
| 135 | } | 136 | } |
| 136 | } | 137 | } |
| 137 | 138 | ||
| 139 | +#pragma mark - UIGestureRecognizerDelegate 手势冲突 | ||
| 140 | +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { | ||
| 141 | + if ([NSStringFromClass([touch.view class]) isEqualToString:@"SevenSwitch"]) { | ||
| 142 | + return NO; | ||
| 143 | + } | ||
| 144 | + return YES; | ||
| 145 | +} | ||
| 146 | + | ||
| 138 | #pragma mark - | 147 | #pragma mark - |
| 139 | #pragma mark - Notification | 148 | #pragma mark - Notification |
| 140 | - (void)addObservers | 149 | - (void)addObservers |
| @@ -342,7 +351,7 @@ | @@ -342,7 +351,7 @@ | ||
| 342 | [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) { | 351 | [self.backBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
| 343 | make.left.equalTo(self.topBgView).with.offset(5); | 352 | make.left.equalTo(self.topBgView).with.offset(5); |
| 344 | make.width.height.mas_equalTo(30); | 353 | make.width.height.mas_equalTo(30); |
| 345 | - make.top.equalTo(self.topBgView).with.offset(20); | 354 | + make.top.equalTo(self.topBgView).with.offset(10); |
| 346 | }]; | 355 | }]; |
| 347 | 356 | ||
| 348 | [self.topBgView mas_makeConstraints:^(MASConstraintMaker *make) { | 357 | [self.topBgView mas_makeConstraints:^(MASConstraintMaker *make) { |
| @@ -364,7 +373,9 @@ | @@ -364,7 +373,9 @@ | ||
| 364 | 373 | ||
| 365 | [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { | 374 | [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) { |
| 366 | make.left.equalTo(self.backBtn).offset(40); | 375 | make.left.equalTo(self.backBtn).offset(40); |
| 367 | - make.top.trailing.bottom.mas_equalTo(0); | 376 | + make.top.mas_equalTo(15); |
| 377 | + make.height.mas_equalTo(20); | ||
| 378 | + make.right.equalTo(self.topBgView).offset(-100); | ||
| 368 | }]; | 379 | }]; |
| 369 | 380 | ||
| 370 | [self.playOrPauseBtn mas_makeConstraints:^(MASConstraintMaker *make) { | 381 | [self.playOrPauseBtn mas_makeConstraints:^(MASConstraintMaker *make) { |
| @@ -387,7 +398,37 @@ | @@ -387,7 +398,37 @@ | ||
| 387 | 398 | ||
| 388 | #pragma mark - | 399 | #pragma mark - |
| 389 | #pragma mark - setter | 400 | #pragma mark - setter |
| 401 | +- (void)setIsFullScreen:(BOOL)isFullScreen | ||
| 402 | +{ | ||
| 403 | + _isFullScreen = isFullScreen; | ||
| 390 | 404 | ||
| 405 | + if (isFullScreen) { | ||
| 406 | + | ||
| 407 | + _barrageSwitch.hidden = NO; | ||
| 408 | + _editBtn.hidden = NO; | ||
| 409 | + | ||
| 410 | + [self.backBtn mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 411 | + make.top.equalTo(self.topBgView).with.offset(20); | ||
| 412 | + }]; | ||
| 413 | + | ||
| 414 | + [self.titleLab mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 415 | + make.top.mas_equalTo(25); | ||
| 416 | + }]; | ||
| 417 | + | ||
| 418 | + } else { | ||
| 419 | + | ||
| 420 | + _barrageSwitch.hidden = YES; | ||
| 421 | + _editBtn.hidden = YES; | ||
| 422 | + | ||
| 423 | + [self.backBtn mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 424 | + make.top.equalTo(self.topBgView).with.offset(10); | ||
| 425 | + }]; | ||
| 426 | + | ||
| 427 | + [self.titleLab mas_updateConstraints:^(MASConstraintMaker *make) { | ||
| 428 | + make.top.mas_equalTo(15); | ||
| 429 | + }]; | ||
| 430 | + } | ||
| 431 | +} | ||
| 391 | 432 | ||
| 392 | #pragma mark - | 433 | #pragma mark - |
| 393 | #pragma mark - getter | 434 | #pragma mark - getter |
| @@ -478,6 +519,7 @@ | @@ -478,6 +519,7 @@ | ||
| 478 | { | 519 | { |
| 479 | if (!_singleTap) { | 520 | if (!_singleTap) { |
| 480 | _singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapView)]; | 521 | _singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapView)]; |
| 522 | + _singleTap.delegate = self; | ||
| 481 | } | 523 | } |
| 482 | return _singleTap; | 524 | return _singleTap; |
| 483 | } | 525 | } |
| @@ -492,7 +534,7 @@ | @@ -492,7 +534,7 @@ | ||
| 492 | _barrageSwitch.activeColor = [UIColor blackColor]; | 534 | _barrageSwitch.activeColor = [UIColor blackColor]; |
| 493 | _barrageSwitch.inactiveColor = [UIColor blackColor]; | 535 | _barrageSwitch.inactiveColor = [UIColor blackColor]; |
| 494 | _barrageSwitch.on = YES; | 536 | _barrageSwitch.on = YES; |
| 495 | -// _barrageSwitch.hidden = YES; | 537 | + _barrageSwitch.hidden = YES; |
| 496 | [_barrageSwitch addTarget:self action:@selector(barrageSwitchAction) forControlEvents:UIControlEventValueChanged]; | 538 | [_barrageSwitch addTarget:self action:@selector(barrageSwitchAction) forControlEvents:UIControlEventValueChanged]; |
| 497 | } | 539 | } |
| 498 | return _barrageSwitch; | 540 | return _barrageSwitch; |
| @@ -504,6 +546,7 @@ | @@ -504,6 +546,7 @@ | ||
| 504 | _editBtn = [UIButton buttonWithType:UIButtonTypeCustom]; | 546 | _editBtn = [UIButton buttonWithType:UIButtonTypeCustom]; |
| 505 | [_editBtn setImage:[UIImage imageNamed:@"Barrage input"] forState:UIControlStateNormal]; | 547 | [_editBtn setImage:[UIImage imageNamed:@"Barrage input"] forState:UIControlStateNormal]; |
| 506 | [_editBtn addTarget:self action:@selector(editBtnAction:) forControlEvents:UIControlEventTouchUpInside]; | 548 | [_editBtn addTarget:self action:@selector(editBtnAction:) forControlEvents:UIControlEventTouchUpInside]; |
| 549 | + _editBtn.hidden = YES; | ||
| 507 | } | 550 | } |
| 508 | return _editBtn; | 551 | return _editBtn; |
| 509 | } | 552 | } |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/fenxiangshupinghou_weixiao.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "fenxiangshupinghou_weixiao.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/fenxiangshupinghou_weixiao.imageset/fenxiangshupinghou_weixiao.png
0 → 100644
1.85 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/keyboard.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "keyboard.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/keyboard.imageset/keyboard.png
0 → 100644
1.67 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/send.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "filename" : "send.png", | ||
| 6 | + "scale" : "1x" | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "idiom" : "universal", | ||
| 14 | + "scale" : "3x" | ||
| 15 | + } | ||
| 16 | + ], | ||
| 17 | + "info" : { | ||
| 18 | + "version" : 1, | ||
| 19 | + "author" : "xcode" | ||
| 20 | + } | ||
| 21 | +} | ||
| 0 | \ No newline at end of file | 22 | \ No newline at end of file |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/player/send.imageset/send.png
0 → 100644
4.77 KB