房间最小化
This commit is contained in:
@@ -172,6 +172,7 @@
|
|||||||
E86596512701A1C000846EBD /* StatisticsService.m in Sources */ = {isa = PBXBuildFile; fileRef = E86596502701A1C000846EBD /* StatisticsService.m */; };
|
E86596512701A1C000846EBD /* StatisticsService.m in Sources */ = {isa = PBXBuildFile; fileRef = E86596502701A1C000846EBD /* StatisticsService.m */; };
|
||||||
E86596542701A55500846EBD /* StatisticsServiceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E86596532701A55500846EBD /* StatisticsServiceHelper.m */; };
|
E86596542701A55500846EBD /* StatisticsServiceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = E86596532701A55500846EBD /* StatisticsServiceHelper.m */; };
|
||||||
E8659909273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = E8659908273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m */; };
|
E8659909273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = E8659908273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m */; };
|
||||||
|
E866B6E52759F96F009B002A /* XPMiniRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = E866B6E42759F96F009B002A /* XPMiniRoomView.m */; };
|
||||||
E8680718271967B00024F48F /* MicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8680717271967B00024F48F /* MicroView.m */; };
|
E8680718271967B00024F48F /* MicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8680717271967B00024F48F /* MicroView.m */; };
|
||||||
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308826E89BE000B90D4F /* LoginPhoneViewController.m */; };
|
E872308926E89BE000B90D4F /* LoginPhoneViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308826E89BE000B90D4F /* LoginPhoneViewController.m */; };
|
||||||
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308C26E89DAA00B90D4F /* LoginInputView.m */; };
|
E872308D26E89DAA00B90D4F /* LoginInputView.m in Sources */ = {isa = PBXBuildFile; fileRef = E872308C26E89DAA00B90D4F /* LoginInputView.m */; };
|
||||||
@@ -632,6 +633,8 @@
|
|||||||
E86596532701A55500846EBD /* StatisticsServiceHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StatisticsServiceHelper.m; sourceTree = "<group>"; };
|
E86596532701A55500846EBD /* StatisticsServiceHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StatisticsServiceHelper.m; sourceTree = "<group>"; };
|
||||||
E8659907273E800D00EE349D /* XPGiftCollectionViewFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCollectionViewFlowLayout.h; sourceTree = "<group>"; };
|
E8659907273E800D00EE349D /* XPGiftCollectionViewFlowLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftCollectionViewFlowLayout.h; sourceTree = "<group>"; };
|
||||||
E8659908273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCollectionViewFlowLayout.m; sourceTree = "<group>"; };
|
E8659908273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCollectionViewFlowLayout.m; sourceTree = "<group>"; };
|
||||||
|
E866B6E32759F96F009B002A /* XPMiniRoomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMiniRoomView.h; sourceTree = "<group>"; };
|
||||||
|
E866B6E42759F96F009B002A /* XPMiniRoomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMiniRoomView.m; sourceTree = "<group>"; };
|
||||||
E8680716271967B00024F48F /* MicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroView.h; sourceTree = "<group>"; };
|
E8680716271967B00024F48F /* MicroView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MicroView.h; sourceTree = "<group>"; };
|
||||||
E8680717271967B00024F48F /* MicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroView.m; sourceTree = "<group>"; };
|
E8680717271967B00024F48F /* MicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroView.m; sourceTree = "<group>"; };
|
||||||
E872308726E89BE000B90D4F /* LoginPhoneViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPhoneViewController.h; sourceTree = "<group>"; };
|
E872308726E89BE000B90D4F /* LoginPhoneViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoginPhoneViewController.h; sourceTree = "<group>"; };
|
||||||
@@ -2053,6 +2056,8 @@
|
|||||||
E8AEAEE927141ACC0017FCE0 /* MenuContainerView */,
|
E8AEAEE927141ACC0017FCE0 /* MenuContainerView */,
|
||||||
180806F92729A354001FD836 /* ThemeColor+Room.h */,
|
180806F92729A354001FD836 /* ThemeColor+Room.h */,
|
||||||
180806FA2729A354001FD836 /* ThemeColor+Room.m */,
|
180806FA2729A354001FD836 /* ThemeColor+Room.m */,
|
||||||
|
E866B6E32759F96F009B002A /* XPMiniRoomView.h */,
|
||||||
|
E866B6E42759F96F009B002A /* XPMiniRoomView.m */,
|
||||||
);
|
);
|
||||||
path = View;
|
path = View;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -2818,6 +2823,7 @@
|
|||||||
18486213271EA9DA005FC5DC /* RtcManager.m in Sources */,
|
18486213271EA9DA005FC5DC /* RtcManager.m in Sources */,
|
||||||
186A536926FC6F2E00D67B2C /* XPShareView.m in Sources */,
|
186A536926FC6F2E00D67B2C /* XPShareView.m in Sources */,
|
||||||
186A534C26FC6ED900D67B2C /* TTAlertView.m in Sources */,
|
186A534C26FC6ED900D67B2C /* TTAlertView.m in Sources */,
|
||||||
|
E866B6E52759F96F009B002A /* XPMiniRoomView.m in Sources */,
|
||||||
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */,
|
E8B825BF26E9E57D009E8E9F /* LoginTicketInfo.m in Sources */,
|
||||||
E8E7DAE82744F5EF00C631CC /* XPGiftStorage.m in Sources */,
|
E8E7DAE82744F5EF00C631CC /* XPGiftStorage.m in Sources */,
|
||||||
E878894C273A607C00BF1D57 /* XPGiftUserCollectionViewCell.m in Sources */,
|
E878894C273A607C00BF1D57 /* XPGiftUserCollectionViewCell.m in Sources */,
|
||||||
|
6
xplan-ios/Assets.xcassets/Room/Mini/Contents.json
Normal file
6
xplan-ios/Assets.xcassets/Room/Mini/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
22
xplan-ios/Assets.xcassets/Room/Mini/room_mini_background.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/Mini/room_mini_background.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "room_mini_background@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "room_mini_background@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
xplan-ios/Assets.xcassets/Room/Mini/room_mini_background.imageset/room_mini_background@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/Mini/room_mini_background.imageset/room_mini_background@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
xplan-ios/Assets.xcassets/Room/Mini/room_mini_background.imageset/room_mini_background@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/Mini/room_mini_background.imageset/room_mini_background@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
22
xplan-ios/Assets.xcassets/Room/Mini/room_mini_close.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/Mini/room_mini_close.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"images" : [
|
||||||
|
{
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "1x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "room_mini_close@2x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "2x"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"filename" : "room_mini_close@3x.png",
|
||||||
|
"idiom" : "universal",
|
||||||
|
"scale" : "3x"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"info" : {
|
||||||
|
"author" : "xcode",
|
||||||
|
"version" : 1
|
||||||
|
}
|
||||||
|
}
|
BIN
xplan-ios/Assets.xcassets/Room/Mini/room_mini_close.imageset/room_mini_close@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/Mini/room_mini_close.imageset/room_mini_close@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 266 B |
BIN
xplan-ios/Assets.xcassets/Room/Mini/room_mini_close.imageset/room_mini_close@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/Mini/room_mini_close.imageset/room_mini_close@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 435 B |
@@ -77,7 +77,7 @@
|
|||||||
|
|
||||||
#pragma mark - Event Response
|
#pragma mark - Event Response
|
||||||
- (void)backButtonAction:(UIButton *)sender {
|
- (void)backButtonAction:(UIButton *)sender {
|
||||||
[self.hostDelegate exitRoom];
|
[self.hostDelegate miniRoom];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)shareButtonAction:(UIButton *)sender{
|
- (void)shareButtonAction:(UIButton *)sender{
|
||||||
|
@@ -18,6 +18,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (RoomInfoModel*)getRoomInfo;
|
- (RoomInfoModel*)getRoomInfo;
|
||||||
- (UserInfoModel*)getUserInfo;
|
- (UserInfoModel*)getUserInfo;
|
||||||
- (void)exitRoom;
|
- (void)exitRoom;
|
||||||
|
- (void)miniRoom;
|
||||||
- (UINavigationController *)getCurrentNav;
|
- (UINavigationController *)getCurrentNav;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
20
xplan-ios/Main/Room/View/XPMiniRoomView.h
Normal file
20
xplan-ios/Main/Room/View/XPMiniRoomView.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// XPMiniRoomView.h
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2021/12/3.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
@class RoomInfoModel;
|
||||||
|
@interface XPMiniRoomView : UIView
|
||||||
|
|
||||||
|
///房间最小化 初始化
|
||||||
|
- (void)configView:(RoomInfoModel *)roomInfo controller:(UIViewController *)controller;
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
272
xplan-ios/Main/Room/View/XPMiniRoomView.m
Normal file
272
xplan-ios/Main/Room/View/XPMiniRoomView.m
Normal file
@@ -0,0 +1,272 @@
|
|||||||
|
//
|
||||||
|
// XPMiniRoomView.m
|
||||||
|
// xplan-ios
|
||||||
|
//
|
||||||
|
// Created by 冯硕 on 2021/12/3.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "XPMiniRoomView.h"
|
||||||
|
///Third
|
||||||
|
#import <Masonry/Masonry.h>
|
||||||
|
///Tool
|
||||||
|
#import "XPMacro.h"
|
||||||
|
#import "ThemeColor.h"
|
||||||
|
#import "NetImageView.h"
|
||||||
|
#import "RtcManager.h"
|
||||||
|
#import "UIButton+EnlargeTouchArea.h"
|
||||||
|
#import "XPNoteView.h"
|
||||||
|
///Model
|
||||||
|
#import "RoomInfoModel.h"
|
||||||
|
///View
|
||||||
|
#import "XPRoomViewController.h"
|
||||||
|
|
||||||
|
@interface XPMiniRoomView ()
|
||||||
|
///底部的底图
|
||||||
|
@property (nonatomic,strong) UIImageView *backImageView;
|
||||||
|
///头像
|
||||||
|
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||||
|
///昵称
|
||||||
|
@property (nonatomic,strong) UILabel *nickLabel;
|
||||||
|
///id
|
||||||
|
@property (nonatomic,strong) UILabel *idLabel;
|
||||||
|
///关闭
|
||||||
|
@property (nonatomic,strong) UIButton *closeButton;
|
||||||
|
///音符
|
||||||
|
@property (nonatomic,strong) XPNoteView *noteView;
|
||||||
|
///房间最小化
|
||||||
|
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||||||
|
///进房需要的控制器
|
||||||
|
@property (nonatomic,weak) UIViewController * controller;
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@implementation XPMiniRoomView
|
||||||
|
|
||||||
|
- (instancetype)initWithFrame:(CGRect)frame {
|
||||||
|
self = [super initWithFrame:frame];
|
||||||
|
if (self) {
|
||||||
|
[self initEvents];
|
||||||
|
[self initSubViews];
|
||||||
|
[self initSubViewConstraints];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
NSLog(@"房间最小化销毁了");
|
||||||
|
}
|
||||||
|
#pragma mark - Public Method
|
||||||
|
- (void)configView:(RoomInfoModel *)roomInfo controller:(UIViewController *)controller {
|
||||||
|
self.roomInfo = roomInfo;
|
||||||
|
self.controller = controller;
|
||||||
|
[self startAvatarAnimation];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Private Method
|
||||||
|
- (void)initSubViews {
|
||||||
|
[self addSubview:self.backImageView];
|
||||||
|
|
||||||
|
[self.backImageView addSubview:self.avatarImageView];
|
||||||
|
[self.backImageView addSubview:self.noteView];
|
||||||
|
[self.backImageView addSubview:self.nickLabel];
|
||||||
|
[self.backImageView addSubview:self.idLabel];
|
||||||
|
[self.backImageView addSubview:self.closeButton];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)initSubViewConstraints {
|
||||||
|
self.frame = CGRectMake(KScreenWidth - 140 * 1.2, KScreenHeight - kSafeAreaBottomHeight - 150, 140 * 1.2, 34 * 1.2);
|
||||||
|
|
||||||
|
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.edges.mas_equalTo(self);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(self.backImageView).offset(5);
|
||||||
|
make.top.bottom.mas_equalTo(self.backImageView).inset(5);
|
||||||
|
make.height.mas_equalTo(self.avatarImageView.mas_width);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(5);
|
||||||
|
make.bottom.mas_equalTo(self.avatarImageView.mas_centerY).offset(-1.5);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.left.mas_equalTo(self.nickLabel);
|
||||||
|
make.top.mas_equalTo(self.avatarImageView.mas_centerY).offset(1.5);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.size.mas_equalTo(CGSizeMake(15, 15));
|
||||||
|
make.centerY.mas_equalTo(self.backImageView);
|
||||||
|
make.right.mas_equalTo(self.backImageView).offset(-11);
|
||||||
|
}];
|
||||||
|
|
||||||
|
[self.noteView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.center.mas_equalTo(self.avatarImageView);
|
||||||
|
make.height.mas_equalTo(12);
|
||||||
|
make.width.mas_equalTo(12);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)initEvents {
|
||||||
|
UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(roomMiniTag:)];
|
||||||
|
[self addGestureRecognizer:pan];
|
||||||
|
|
||||||
|
UITapGestureRecognizer *enterRoomTag = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(enterRomRecognizer:)];
|
||||||
|
[self.avatarImageView addGestureRecognizer:enterRoomTag];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)startAvatarAnimation {
|
||||||
|
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
|
||||||
|
rotationAnimation.toValue = [NSNumber numberWithFloat: M_PI * 2.0 ];
|
||||||
|
rotationAnimation.duration = 3;
|
||||||
|
rotationAnimation.cumulative = YES;
|
||||||
|
rotationAnimation.repeatCount = MAXFLOAT;
|
||||||
|
rotationAnimation.removedOnCompletion = NO;
|
||||||
|
[self.avatarImageView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Event Response
|
||||||
|
- (void)closeButtonAction:(UIButton *)sender {
|
||||||
|
[[RtcManager instance] exitRoom];
|
||||||
|
[self.avatarImageView.layer removeAllAnimations];
|
||||||
|
[self.noteView stopAnimation];
|
||||||
|
[self removeFromSuperview];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)enterRomRecognizer:(UITapGestureRecognizer *)tap {
|
||||||
|
if (self.roomInfo.uid > 0 && self.controller) {
|
||||||
|
[self removeFromSuperview];
|
||||||
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid];
|
||||||
|
[XPRoomViewController openRoom:roomUid viewController:self.controller];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)roomMiniTag:(UIPanGestureRecognizer*)p {
|
||||||
|
UIWindow *appWindow = [UIApplication sharedApplication].delegate.window;
|
||||||
|
CGPoint panPoint = [p locationInView:appWindow];
|
||||||
|
if (p.state == UIGestureRecognizerStateBegan) {
|
||||||
|
self.alpha = 1;
|
||||||
|
} else if(p.state == UIGestureRecognizerStateChanged) {
|
||||||
|
self.center = CGPointMake(panPoint.x, panPoint.y);
|
||||||
|
} else if(p.state == UIGestureRecognizerStateEnded
|
||||||
|
|| p.state == UIGestureRecognizerStateCancelled) {
|
||||||
|
self.alpha = 1;
|
||||||
|
CGFloat touchWidth = self.frame.size.width;
|
||||||
|
CGFloat touchHeight = self.frame.size.height;
|
||||||
|
CGFloat screenWidth = [[UIScreen mainScreen] bounds].size.width;
|
||||||
|
CGFloat screenHeight = [[UIScreen mainScreen] bounds].size.height;
|
||||||
|
// fabs 是取绝对值的意思
|
||||||
|
CGFloat left = fabs(panPoint.x);
|
||||||
|
CGFloat right = fabs(screenWidth - left);
|
||||||
|
CGFloat top = fabs(panPoint.y);
|
||||||
|
CGFloat bottom = fabs(screenHeight - top);
|
||||||
|
CGFloat minSpace = 0;
|
||||||
|
minSpace = MIN(MIN(MIN(top, left), bottom), right);
|
||||||
|
CGPoint newCenter;
|
||||||
|
CGFloat targetY = 0;
|
||||||
|
//校正Y
|
||||||
|
if (panPoint.y < 15 + touchHeight / 2.0) {
|
||||||
|
targetY = 15 + touchHeight / 2.0;
|
||||||
|
}else if (panPoint.y > (screenHeight - touchHeight / 2.0 - 15)) {
|
||||||
|
targetY = screenHeight - touchHeight / 2.0 - 15;
|
||||||
|
}else{
|
||||||
|
targetY = panPoint.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minSpace == left) {
|
||||||
|
newCenter = CGPointMake(15+touchWidth/2.0, targetY);
|
||||||
|
}else if (minSpace == right) {
|
||||||
|
newCenter = CGPointMake(screenWidth - touchWidth/2.0 - 15, targetY);
|
||||||
|
}else if (minSpace == top) {
|
||||||
|
newCenter = CGPointMake(panPoint.x, touchWidth / 3);
|
||||||
|
}else {
|
||||||
|
newCenter = CGPointMake(panPoint.x, screenHeight - touchWidth / 3);
|
||||||
|
}
|
||||||
|
[UIView animateWithDuration:0.25 animations:^{
|
||||||
|
if (newCenter.y + self.frame.size.height / 2 > KScreenHeight - kSafeAreaBottomHeight - 44) {
|
||||||
|
self.center = CGPointMake(newCenter.x, KScreenHeight - self.frame.size.height / 2 - kSafeAreaBottomHeight - 44);
|
||||||
|
}else {
|
||||||
|
self.center = newCenter;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
} else {
|
||||||
|
NSLog(@"pan state : %zd", p.state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark - Getters And Setters
|
||||||
|
- (void)setRoomInfo:(RoomInfoModel *)roomInfo {
|
||||||
|
_roomInfo = roomInfo;
|
||||||
|
if (_roomInfo) {
|
||||||
|
self.avatarImageView.imageUrl = _roomInfo.avatar;
|
||||||
|
if (_roomInfo.title.length > 8) {
|
||||||
|
_roomInfo.title = [NSString stringWithFormat:@"%@…", [_roomInfo.title substringToIndex:8]];
|
||||||
|
}
|
||||||
|
self.nickLabel.text = _roomInfo.title;
|
||||||
|
self.idLabel.text = [NSString stringWithFormat:@"%@号:%ld", AppName,_roomInfo.erbanNo];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIImageView *)backImageView {
|
||||||
|
if (!_backImageView) {
|
||||||
|
_backImageView = [[UIImageView alloc] init];
|
||||||
|
_backImageView.userInteractionEnabled = YES;
|
||||||
|
_backImageView.image = [UIImage imageNamed:@"room_mini_background"];
|
||||||
|
}
|
||||||
|
return _backImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NetImageView *)avatarImageView {
|
||||||
|
if (!_avatarImageView) {
|
||||||
|
NetImageConfig * config = [[NetImageConfig alloc] init];
|
||||||
|
config.imageType = ImageTypeUserIcon;
|
||||||
|
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||||
|
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||||
|
_avatarImageView.layer.masksToBounds = YES;
|
||||||
|
_avatarImageView.layer.cornerRadius = (34 * 1.2 - 10)/2;
|
||||||
|
_avatarImageView.userInteractionEnabled = YES;
|
||||||
|
}
|
||||||
|
return _avatarImageView;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UILabel *)nickLabel {
|
||||||
|
if (!_nickLabel) {
|
||||||
|
_nickLabel = [[UILabel alloc] init];
|
||||||
|
_nickLabel.font = [UIFont systemFontOfSize:12];
|
||||||
|
_nickLabel.textColor = [ThemeColor mainTextColor];
|
||||||
|
}
|
||||||
|
return _nickLabel;
|
||||||
|
}
|
||||||
|
- (UILabel *)idLabel {
|
||||||
|
if (!_idLabel) {
|
||||||
|
_idLabel = [[UILabel alloc] init];
|
||||||
|
_idLabel.font = [UIFont systemFontOfSize:10];
|
||||||
|
_idLabel.textColor = [ThemeColor mainTextColor];
|
||||||
|
}
|
||||||
|
return _idLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UIButton *)closeButton {
|
||||||
|
if (!_closeButton) {
|
||||||
|
_closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
[_closeButton setImage:[UIImage imageNamed:@"room_mini_close"] forState:UIControlStateNormal];
|
||||||
|
[_closeButton addTarget:self action:@selector(closeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
[_closeButton setEnlargeEdgeWithTop:5 right:5 bottom:5 left:5];
|
||||||
|
}
|
||||||
|
return _closeButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (XPNoteView *)noteView {
|
||||||
|
if (!_noteView) {
|
||||||
|
_noteView = [[XPNoteView alloc] init];
|
||||||
|
_noteView.pillarColor = [UIColor colorWithWhite:1 alpha:0.6];
|
||||||
|
_noteView.pillarWidth = 2;
|
||||||
|
[_noteView startAnimation];
|
||||||
|
}
|
||||||
|
return _noteView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -32,6 +32,8 @@
|
|||||||
#import "RoomHostDelegate.h"
|
#import "RoomHostDelegate.h"
|
||||||
#import "RoomGuestDelegate.h"
|
#import "RoomGuestDelegate.h"
|
||||||
|
|
||||||
|
NSString * const kRoomMiniNotificationKey = @"RoomMiniNotificationKey";
|
||||||
|
|
||||||
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate>
|
@interface XPRoomViewController ()<XPRoomProtocol, RoomHostDelegate, NIMChatroomManagerDelegate>
|
||||||
///背景
|
///背景
|
||||||
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
|
@property (nonatomic,strong) XPRoomBackContainerView *backContainerView;
|
||||||
@@ -223,6 +225,13 @@
|
|||||||
[self dismissViewControllerAnimated:YES completion:nil];
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)miniRoom {
|
||||||
|
//使用了不是太优雅的办法 做了房间最小化 因为想把最小化的view 放在tabbar上 但是roomVC 好像和tabbar 没啥关系哦
|
||||||
|
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomMiniNotificationKey object:self.roomInfo];
|
||||||
|
[self.view endEditing:YES];
|
||||||
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (XPRoomBackContainerView *)backContainerView {
|
- (XPRoomBackContainerView *)backContainerView {
|
||||||
if (!_backContainerView) {
|
if (!_backContainerView) {
|
||||||
_backContainerView = [[XPRoomBackContainerView alloc] initWithdelegate:self];
|
_backContainerView = [[XPRoomBackContainerView alloc] initWithdelegate:self];
|
||||||
|
@@ -28,11 +28,12 @@
|
|||||||
#import "XPMineViewController.h"
|
#import "XPMineViewController.h"
|
||||||
#import "SessionListViewController.h"
|
#import "SessionListViewController.h"
|
||||||
#import "XPHomeContainerViewController.h"
|
#import "XPHomeContainerViewController.h"
|
||||||
|
#import "XPMiniRoomView.h"
|
||||||
///Present
|
///Present
|
||||||
#import "MainPresenter.h"
|
#import "MainPresenter.h"
|
||||||
#import "MainProtocol.h"
|
#import "MainProtocol.h"
|
||||||
|
|
||||||
|
UIKIT_EXTERN NSString * kRoomMiniNotificationKey;
|
||||||
|
|
||||||
@interface TabbarViewController () <BaseMvpProtocol, MainProtocol, NIMLoginManagerDelegate>
|
@interface TabbarViewController () <BaseMvpProtocol, MainProtocol, NIMLoginManagerDelegate>
|
||||||
|
|
||||||
@@ -49,6 +50,8 @@
|
|||||||
|
|
||||||
[[NIMSDK sharedSDK].loginManager addDelegate:self];
|
[[NIMSDK sharedSDK].loginManager addDelegate:self];
|
||||||
[self.presenter juliandAdCallBackApi];
|
[self.presenter juliandAdCallBackApi];
|
||||||
|
[self roomMiniNotification];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewWillAppear:(BOOL)animated {
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
@@ -201,4 +204,23 @@
|
|||||||
[XCHUDTool hideHUD];
|
[XCHUDTool hideHUD];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - 房间最小化的通知
|
||||||
|
- (void)roomMiniNotification {
|
||||||
|
[[NSNotificationCenter defaultCenter] addObserverForName:kRoomMiniNotificationKey object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
|
||||||
|
__block XPMiniRoomView * view;
|
||||||
|
[self.view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
|
if ([obj isKindOfClass:[XPMiniRoomView class]]) {
|
||||||
|
view = obj;
|
||||||
|
*stop = YES;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
RoomInfoModel * roomInfo = note.object;
|
||||||
|
if (view == nil) {
|
||||||
|
view = [[XPMiniRoomView alloc] init];
|
||||||
|
[self.view addSubview:view];
|
||||||
|
}
|
||||||
|
[view configView:roomInfo controller:self];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Reference in New Issue
Block a user