增加房间
BIN
yinmeng-ios/1.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
yinmeng-ios/2.png
Normal file
After Width: | Height: | Size: 7.5 KiB |
BIN
yinmeng-ios/3.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
6
yinmeng-ios/Assets.xcassets/room/MicSeat/Contents.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
22
yinmeng-ios/Assets.xcassets/room/MicSeat/room_mic_gift_value_icon.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_mic_gift_value_icon@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_mic_gift_value_icon@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 957 B |
After Width: | Height: | Size: 1.5 KiB |
22
yinmeng-ios/Assets.xcassets/room/MicSeat/yin_room_mic_position_normal.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "yin_room_mic_position_normal@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "yin_room_mic_position_normal@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.9 KiB |
@@ -120,6 +120,56 @@ extension UIImage{
|
||||
UIGraphicsEndImageContext()
|
||||
return image
|
||||
}
|
||||
|
||||
|
||||
|
||||
static func createImageWithCorners(color:UIColor, size: CGSize, topLeft: CGFloat, topRight: CGFloat, bottomLeft: CGFloat, bottomRight: CGFloat) -> UIImage? {
|
||||
UIGraphicsBeginImageContextWithOptions(size, false, 0)
|
||||
guard let context = UIGraphicsGetCurrentContext() else { return nil }
|
||||
|
||||
let path = UIBezierPath(rect: CGRect(origin: .zero, size: size))
|
||||
context.addPath(path.cgPath)
|
||||
|
||||
// 设置左上角的圆角
|
||||
path.move(to: CGPoint(x: topLeft, y: 0))
|
||||
path.addLine(to: CGPoint(x: 0, y: topLeft))
|
||||
if topLeft > 0 {
|
||||
path.addArc(withCenter: CGPoint(x: topLeft, y: topLeft), radius: topLeft, startAngle: CGFloat.pi, endAngle: CGFloat.pi * 3 / 2, clockwise: true)
|
||||
}
|
||||
|
||||
// 设置右上角的圆角
|
||||
let topRightFrom = CGPoint(x: size.width - topRight, y: 0)
|
||||
path.addLine(to: topRightFrom)
|
||||
if topRight > 0 {
|
||||
path.addArc(withCenter: CGPoint(x: size.width - topRight, y: topRight), radius: topRight, startAngle: CGFloat.pi * 3 / 2, endAngle: CGFloat.pi, clockwise: true)
|
||||
}
|
||||
|
||||
// 设置左下角的圆角
|
||||
let bottomLeftFrom = CGPoint(x: 0, y: size.height - bottomLeft)
|
||||
path.addLine(to: bottomLeftFrom)
|
||||
if bottomLeft > 0 {
|
||||
path.addArc(withCenter: CGPoint(x: bottomLeft, y: size.height - bottomLeft), radius: bottomLeft, startAngle: 0, endAngle: CGFloat.pi / 2, clockwise: false)
|
||||
}
|
||||
|
||||
// 设置右下角的圆角
|
||||
path.addLine(to: CGPoint(x: size.width, y: size.height - bottomRight))
|
||||
if bottomRight > 0 {
|
||||
path.addArc(withCenter: CGPoint(x: size.width - bottomRight, y: size.height - bottomRight), radius: bottomRight, startAngle: CGFloat.pi / 2, endAngle: 0, clockwise: false)
|
||||
}
|
||||
|
||||
path.close()
|
||||
context.clip()
|
||||
|
||||
// 填充颜色,或者可以在这里添加自定义的图片
|
||||
context.setFillColor(color.cgColor)
|
||||
context.fillPath()
|
||||
|
||||
let image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
UIGraphicsEndImageContext()
|
||||
return image
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
extension UIImage{
|
||||
|
@@ -7,7 +7,7 @@
|
||||
|
||||
import Foundation
|
||||
extension UILabel{
|
||||
static func getCustomLabel(text:String? = "",font:UIFont? = nil,color:UIColor? = nil,textAlignment:NSTextAlignment? = .left)->UILabel{
|
||||
static func getCustomLabel(text:String? = "",font:UIFont? = nil,color:UIColor? = nil,textAlignment:NSTextAlignment? = .left,numberOfLines:Int? = 1)->UILabel{
|
||||
let customView = UILabel()
|
||||
if let _text = text {
|
||||
customView.text = text
|
||||
@@ -21,6 +21,9 @@ extension UILabel{
|
||||
if let _textAlignment = textAlignment{
|
||||
customView.textAlignment = _textAlignment
|
||||
}
|
||||
if let _numberOfLines = numberOfLines{
|
||||
customView.numberOfLines = _numberOfLines
|
||||
}
|
||||
return customView
|
||||
}
|
||||
static func getLabelHeigth(text:String,width:CGFloat,font:UIFont)-> CGFloat{
|
||||
|
@@ -12,9 +12,5 @@
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
</dict>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>audio</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@@ -16,6 +16,8 @@ class RoomVC: BaseViewController, HiddenNavigationBarProtocol {
|
||||
private func setUILayout(){
|
||||
view.addSubview(backgroundView)
|
||||
view.addSubview(topView)
|
||||
view.addSubview(micSeatView)
|
||||
view.addSubview(chatScreenView)
|
||||
backgroundView.snp.makeConstraints { make in
|
||||
make.edges.equalTo(self.view)
|
||||
}
|
||||
@@ -23,6 +25,18 @@ class RoomVC: BaseViewController, HiddenNavigationBarProtocol {
|
||||
make.leading.trailing.top.equalTo(self.view)
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: NavHeight))
|
||||
}
|
||||
micSeatView.snp.makeConstraints { make in
|
||||
make.leading.trailing.equalTo(self.view)
|
||||
make.top.equalTo(self.topView.snp.bottom).offset(UIDevice.scaleWidth(width: 30))
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: 340))
|
||||
}
|
||||
chatScreenView.snp.makeConstraints { make in
|
||||
make.top.equalTo(micSeatView.snp.bottom).offset(UIDevice.scaleWidth(width: 5))
|
||||
make.leading.equalTo(UIDevice.scaleWidth(width: 0))
|
||||
make.trailing.equalTo(-UIDevice.scaleWidth(width: 90))
|
||||
make.bottom.equalTo(-UIDevice.scaleWidth(width: 0))
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private func requestData(){
|
||||
@@ -38,4 +52,14 @@ class RoomVC: BaseViewController, HiddenNavigationBarProtocol {
|
||||
|
||||
return _topView
|
||||
}()
|
||||
private lazy var micSeatView:MicSeatSuperView = {
|
||||
let _micSeatView = NormalMicSeatSuperView(frame: .zero)
|
||||
|
||||
return _micSeatView
|
||||
}()
|
||||
private lazy var chatScreenView:RoomChatScreenView = {
|
||||
let _chatScreenView = RoomChatScreenView(frame: .zero)
|
||||
|
||||
return _chatScreenView
|
||||
}()
|
||||
}
|
||||
|
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// NormalMicSeatCell.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by duoban on 2024/3/8.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class NormalMicSeatCell: UICollectionViewCell {
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
setUILayout()
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
private func setUILayout(){
|
||||
backgroundColor = .clear
|
||||
contentView.addSubview(micSeatView)
|
||||
micSeatView.snp.makeConstraints { make in
|
||||
make.edges.equalTo(contentView)
|
||||
}
|
||||
}
|
||||
var text:String = ""{
|
||||
didSet{
|
||||
micSeatView.nameView.text = "号麦位"
|
||||
micSeatView.postionView.text = "\(text)"
|
||||
}
|
||||
}
|
||||
//MARK: - 懒加载
|
||||
private lazy var micSeatView:NormalMicSeatView = {
|
||||
let _micSeatView = NormalMicSeatView(frame: .zero, isOwner: false)
|
||||
|
||||
return _micSeatView
|
||||
}()
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// MicSeatSuperView.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by duoban on 2024/3/8.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MicSeatSuperView: UIView {
|
||||
|
||||
/*
|
||||
// Only override draw() if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
override func draw(_ rect: CGRect) {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
@@ -0,0 +1,73 @@
|
||||
//
|
||||
// NormalMicSeatSuperView.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by duoban on 2024/3/8.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class NormalMicSeatSuperView: MicSeatSuperView {
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
setUILayout()
|
||||
registerCell()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
private func setUILayout(){
|
||||
addSubview(roomOwnerView)
|
||||
addSubview(collectionView)
|
||||
roomOwnerView.snp.makeConstraints { make in
|
||||
|
||||
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: 103))
|
||||
make.top.leading.trailing.equalTo(UIDevice.scaleWidth(width: 0))
|
||||
}
|
||||
collectionView.snp.makeConstraints { make in
|
||||
make.top.equalTo(roomOwnerView.snp.bottom).offset(UIDevice.scaleWidth(width: 18))
|
||||
make.leading.bottom.trailing.equalTo(self).inset(UIDevice.scaleWidth(width: 0))
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
private func registerCell(){
|
||||
collectionView.register(NormalMicSeatCell.self, forCellWithReuseIdentifier: "NormalMicSeatCell")
|
||||
collectionView.delegate = self
|
||||
collectionView.dataSource = self
|
||||
}
|
||||
//MARK: - 懒加载
|
||||
|
||||
private lazy var roomOwnerView:NormalMicSeatView = {
|
||||
let _roomOwnerView = NormalMicSeatView(frame: .zero, isOwner: true)
|
||||
return _roomOwnerView
|
||||
}()
|
||||
|
||||
private lazy var collectionView:UICollectionView = {
|
||||
let flowLayout = UICollectionViewFlowLayout()
|
||||
|
||||
flowLayout.sectionInset = UIEdgeInsets(top: 0, left: UIDevice.scaleWidth(width: 10), bottom: 0, right: UIDevice.scaleWidth(width: 10))
|
||||
let width = ScreenWidth - UIDevice.scaleWidth(width: 20)
|
||||
flowLayout.itemSize = CGSize(width: width/4, height: UIDevice.scaleWidth(width: 100))
|
||||
flowLayout.minimumLineSpacing = UIDevice.scaleWidth(width: 15)
|
||||
flowLayout.minimumInteritemSpacing = 0
|
||||
let _collectionView = UICollectionView(frame: .zero, collectionViewLayout: flowLayout)
|
||||
_collectionView.backgroundColor = .clear
|
||||
return _collectionView
|
||||
}()
|
||||
|
||||
}
|
||||
|
||||
extension NormalMicSeatSuperView:UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 8
|
||||
}
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "NormalMicSeatCell", for: indexPath) as! NormalMicSeatCell
|
||||
cell.text = "\(indexPath.row)"
|
||||
return cell
|
||||
}
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// MicSeatGiftNumView.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by duoban on 2024/3/8.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MicSeatGiftValueView: UIView {
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
setUILayout()
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
private func setUILayout(){
|
||||
addSubview(backgroundView)
|
||||
backgroundView.addSubview(giftIconView)
|
||||
backgroundView.addSubview(numView)
|
||||
|
||||
backgroundView.snp.makeConstraints { make in
|
||||
make.edges.equalTo(self)
|
||||
}
|
||||
giftIconView.snp.makeConstraints { make in
|
||||
make.leading.equalTo(UIDevice.scaleWidth(width: 4))
|
||||
make.centerY.equalTo(backgroundView)
|
||||
make.width.height.equalTo(UIDevice.scaleWidth(width: 11))
|
||||
}
|
||||
numView.snp.makeConstraints { make in
|
||||
make.leading.equalTo(giftIconView.snp.trailing).offset((UIDevice.scaleWidth(width: 3)))
|
||||
make.centerY.equalTo(giftIconView)
|
||||
make.trailing.equalTo(-UIDevice.scaleWidth(width: 4))
|
||||
}
|
||||
}
|
||||
//MARK: - 懒加载
|
||||
private lazy var backgroundView:UIView = {
|
||||
let _backgroundView = UIView()
|
||||
_backgroundView.backgroundColor = ThemeColor(hexStr: "#FFFFFF", alpha: 0.3)
|
||||
_backgroundView.layer.cornerRadius = UIDevice.scaleWidth(width: 16)/2
|
||||
_backgroundView.layer.masksToBounds = true
|
||||
return _backgroundView
|
||||
}()
|
||||
private lazy var giftIconView:UIImageView = {
|
||||
let _giftIconView = UIImageView()
|
||||
_giftIconView.isUserInteractionEnabled = true
|
||||
_giftIconView.image = UIImage(named: "room_mic_gift_value_icon")
|
||||
|
||||
return _giftIconView
|
||||
}()
|
||||
private lazy var numView:UILabel = {
|
||||
let _numView = UILabel.getCustomLabel(text: "0",font: UIFont.getScaleFont(ofSize: 10, weight: .regular),color: .white)
|
||||
|
||||
return _numView
|
||||
}()
|
||||
}
|
@@ -0,0 +1,130 @@
|
||||
//
|
||||
// NormalMicSeatView.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by duoban on 2024/3/8.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class NormalMicSeatView: UIView {
|
||||
|
||||
init(frame: CGRect,isOwner:Bool) {
|
||||
super.init(frame: frame)
|
||||
self.isOwner = isOwner
|
||||
if isOwner{
|
||||
setOwnerUILayout()
|
||||
return
|
||||
}
|
||||
setUILayout()
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
private func setOwnerUILayout(){
|
||||
addSubview(avatarView)
|
||||
addSubview(nameStackView)
|
||||
|
||||
|
||||
nameStackView.addArrangedSubview(postionView)
|
||||
nameStackView.addArrangedSubview(nameView)
|
||||
nameStackView.addArrangedSubview(genderView)
|
||||
nameStackView.addArrangedSubview(giftValueView)
|
||||
|
||||
avatarView.snp.makeConstraints { make in
|
||||
make.width.height.equalTo(UIDevice.scaleWidth(width: 58))
|
||||
make.centerX.equalTo(self)
|
||||
}
|
||||
nameStackView.snp.makeConstraints { make in
|
||||
make.top.equalTo(avatarView.snp.bottom).offset(UIDevice.scaleWidth(width: 10))
|
||||
make.width.lessThanOrEqualTo(self)
|
||||
make.centerX.equalTo(self)
|
||||
}
|
||||
postionView.snp.makeConstraints { make in
|
||||
make.width.height.equalTo(UIDevice.scaleWidth(width: 14))
|
||||
}
|
||||
giftValueView.snp.makeConstraints { make in
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: 16))
|
||||
}
|
||||
|
||||
avatarView.layer.cornerRadius = UIDevice.scaleWidth(width: 58) / 2
|
||||
genderView.isHidden = false
|
||||
postionView.isHidden = true
|
||||
}
|
||||
private func setUILayout(){
|
||||
addSubview(avatarView)
|
||||
addSubview(nameStackView)
|
||||
addSubview(giftValueView)
|
||||
|
||||
nameStackView.addArrangedSubview(postionView)
|
||||
nameStackView.addArrangedSubview(nameView)
|
||||
nameStackView.addArrangedSubview(genderView)
|
||||
|
||||
avatarView.snp.makeConstraints { make in
|
||||
make.width.height.equalTo(UIDevice.scaleWidth(width: 55))
|
||||
make.centerX.equalTo(self)
|
||||
}
|
||||
nameStackView.snp.makeConstraints { make in
|
||||
make.top.equalTo(avatarView.snp.bottom).offset(UIDevice.scaleWidth(width: 10))
|
||||
make.width.lessThanOrEqualTo(self)
|
||||
make.centerX.equalTo(self)
|
||||
}
|
||||
postionView.snp.makeConstraints { make in
|
||||
make.width.height.equalTo(UIDevice.scaleWidth(width: 14))
|
||||
}
|
||||
giftValueView.snp.makeConstraints { make in
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: 16))
|
||||
make.top.equalTo(nameStackView.snp.bottom).offset(UIDevice.scaleWidth(width: 5))
|
||||
make.centerX.equalTo(avatarView)
|
||||
make.width.lessThanOrEqualTo(self)
|
||||
}
|
||||
|
||||
avatarView.layer.cornerRadius = UIDevice.scaleWidth(width: 55) / 2
|
||||
genderView.isHidden = true
|
||||
postionView.isHidden = false
|
||||
}
|
||||
private var isOwner:Bool = false
|
||||
//MARK: - 懒加载
|
||||
private lazy var avatarView:UIImageView = {
|
||||
let _avatarView = UIImageView()
|
||||
_avatarView.isUserInteractionEnabled = true
|
||||
_avatarView.layer.masksToBounds = true
|
||||
_avatarView.image = UIImage(named: "yin_room_mic_position_normal")
|
||||
return _avatarView
|
||||
}()
|
||||
|
||||
private lazy var nameStackView:UIStackView = {
|
||||
let _nameStackView = UIStackView()
|
||||
_nameStackView.axis = .horizontal
|
||||
_nameStackView.distribution = .fill
|
||||
_nameStackView.alignment = .center
|
||||
_nameStackView.spacing = UIDevice.scaleWidth(width: 2)
|
||||
return _nameStackView
|
||||
}()
|
||||
lazy var postionView:UILabel = {
|
||||
let _postionView = UILabel.getCustomLabel(font: UIFont.getScaleFont(ofSize: 10, weight: .regular),color: .white,textAlignment: .center)
|
||||
_postionView.layer.cornerRadius = UIDevice.scaleWidth(width:14)/2
|
||||
_postionView.layer.masksToBounds = true
|
||||
_postionView.backgroundColor = ThemeColor(hexStr: "#FFFFFF", alpha: 0.2)
|
||||
return _postionView
|
||||
}()
|
||||
|
||||
lazy var nameView:UILabel = {
|
||||
let _nameView = UILabel.getCustomLabel(text:"小灰类",font: UIFont.getScaleFont(ofSize: 10, weight: .regular),color: .white,textAlignment: .center)
|
||||
return _nameView
|
||||
}()
|
||||
private lazy var genderView:UIImageView = {
|
||||
let _genderView = UIImageView()
|
||||
_genderView.image = UIImage(named: "yin_plane_star__woman")
|
||||
return _genderView
|
||||
}()
|
||||
private lazy var giftValueView:MicSeatGiftValueView = {
|
||||
let _giftValueView = MicSeatGiftValueView(frame: .zero)
|
||||
_giftValueView.isUserInteractionEnabled = true
|
||||
return _giftValueView
|
||||
}()
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// RoomChatScreenHeaderView.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by duoban on 2024/3/8.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class RoomChatScreenHeaderView: UIView {
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
setUILayout()
|
||||
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
private func setUILayout(){
|
||||
backgroundColor = .clear
|
||||
addSubview(backgroundView)
|
||||
addSubview(contentView)
|
||||
let width:CGFloat = ScreenWidth - UIDevice.scaleWidth(width: 105)
|
||||
let height = UILabel.getLabelHeigth(text: contentView.text ?? "", width: width - UIDevice.scaleWidth(width: 20), font: contentView.font) + UIDevice.scaleWidth(width: 20)
|
||||
self.frame = CGRect(x: 0, y: 0, width: width, height: height)
|
||||
|
||||
|
||||
backgroundView.snp.makeConstraints { make in
|
||||
make.leading.trailing.top.equalTo(self)
|
||||
make.bottom.equalTo(-UIDevice.scaleWidth(width: 10))
|
||||
}
|
||||
contentView.snp.makeConstraints { make in
|
||||
make.leading.trailing.equalTo(self).inset(UIDevice.scaleWidth(width: 10))
|
||||
make.centerY.equalTo(self.backgroundView)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
var color:UIColor? = nil{
|
||||
didSet{
|
||||
guard let _color = color else { return }
|
||||
backgroundView.backgroundColor = _color
|
||||
}
|
||||
}
|
||||
//MARK: - 懒加载
|
||||
private lazy var backgroundView:UIView = {
|
||||
let _backgroundView = UIView()
|
||||
_backgroundView.backgroundColor = ThemeColor(hexStr: "#FFFFFF", alpha: 0.15)
|
||||
_backgroundView.layer.cornerRadius = UIDevice.scaleWidth(width: 7)
|
||||
_backgroundView.layer.masksToBounds = true
|
||||
return _backgroundView
|
||||
}()
|
||||
|
||||
private lazy var contentView:UILabel = {
|
||||
let _contentView = UILabel.getCustomLabel(text: "平台严禁未成年人直播或打赏,倡导绿色互动,禁止宣传及发布政治、低俗、暴力、色情等违规违法内容,严禁违规交易和诱导欺诈用户,如有违规将对账号进行封禁,发现请及时举报。",font: UIFont.getScaleFont(ofSize: 12, weight: .regular),color: ThemeColor(hexStr: "#05FFE3"),numberOfLines: 0)
|
||||
|
||||
return _contentView
|
||||
}()
|
||||
}
|
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// RoomChatScreenUserChatView.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by duoban on 2024/3/8.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class RoomChatScreenUserChatCell: UITableViewCell {
|
||||
|
||||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
setUILayout()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
private func setUILayout(){
|
||||
layer.masksToBounds = true
|
||||
selectionStyle = .none
|
||||
backgroundColor = .clear
|
||||
contentView.addSubview(avatarVeiw)
|
||||
contentView.addSubview(nameStackView)
|
||||
contentView.addSubview(tagStackView)
|
||||
contentView.addSubview(bgTextView)
|
||||
|
||||
|
||||
|
||||
nameStackView.addArrangedSubview(vipImageView)
|
||||
nameStackView.addArrangedSubview(nameView)
|
||||
|
||||
tagStackView.addArrangedSubview(experIconView)
|
||||
tagStackView.addArrangedSubview(charmIconView)
|
||||
|
||||
bgTextView.addSubview(textView)
|
||||
|
||||
|
||||
nameStackView.snp.makeConstraints { make in
|
||||
make.leading.equalTo(UIDevice.scaleWidth(width: 38))
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: 26))
|
||||
make.top.equalTo(UIDevice.scaleWidth(width: 0))
|
||||
}
|
||||
vipImageView.snp.makeConstraints { make in
|
||||
make.width.height.equalTo(UIDevice.scaleWidth(width: 26))
|
||||
}
|
||||
avatarVeiw.snp.makeConstraints { make in
|
||||
make.top.equalTo(nameStackView.snp.top).offset(UIDevice.scaleWidth(width: 5))
|
||||
make.width.height.equalTo(UIDevice.scaleWidth(width: 36))
|
||||
make.leading.equalTo(UIDevice.scaleWidth(width: 0))
|
||||
|
||||
}
|
||||
|
||||
tagStackView.snp.makeConstraints { make in
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: 18))
|
||||
make.top.equalTo(nameStackView.snp.bottom).offset(UIDevice.scaleWidth(width: 0))
|
||||
make.leading.equalTo(avatarVeiw.snp.trailing).offset((UIDevice.scaleWidth(width: 8)))
|
||||
}
|
||||
|
||||
experIconView.snp.makeConstraints { make in
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: 18))
|
||||
make.width.equalTo(UIDevice.scaleWidth(width: 21))
|
||||
}
|
||||
charmIconView.snp.makeConstraints { make in
|
||||
make.height.equalTo(UIDevice.scaleWidth(width: 18))
|
||||
make.width.equalTo(UIDevice.scaleWidth(width: 21))
|
||||
}
|
||||
let width = ScreenWidth - UIDevice.scaleWidth(width: 148)
|
||||
bgTextView.snp.makeConstraints { make in
|
||||
make.top.equalTo(tagStackView.snp.bottom).offset(UIDevice.scaleWidth(width: 6))
|
||||
make.leading.equalTo(tagStackView)
|
||||
make.width.lessThanOrEqualTo(width)
|
||||
make.height.greaterThanOrEqualTo(10)
|
||||
}
|
||||
|
||||
textView.snp.makeConstraints { make in
|
||||
make.top.bottom.equalTo(bgTextView).inset(UIDevice.scaleWidth(width: 8))
|
||||
make.leading.trailing.equalTo(bgTextView).inset(UIDevice.scaleWidth(width: 12))
|
||||
}
|
||||
bgTextView.superview?.layoutIfNeeded()
|
||||
}
|
||||
override func layoutSubviews() {
|
||||
// bgTextView.addCorner(cornerRadii: CornerRadii(topLeft: 6,topRight: 12,bottomLeft: 12,bottomRight: 12), frame: bgTextView.frame)
|
||||
}
|
||||
//MARK: - 懒加载
|
||||
private lazy var avatarVeiw:UIImageView = {
|
||||
let _avatarVeiw = UIImageView()
|
||||
_avatarVeiw.layer.cornerRadius = UIDevice.scaleWidth(width: 36)/2
|
||||
_avatarVeiw.layer.masksToBounds = true
|
||||
_avatarVeiw.layer.borderColor = ThemeColor(hexStr: "#FFE710").cgColor
|
||||
_avatarVeiw.backgroundColor = .red
|
||||
_avatarVeiw.isUserInteractionEnabled = true
|
||||
return _avatarVeiw
|
||||
}()
|
||||
private lazy var nameStackView:UIStackView = {
|
||||
let _nameStackView = UIStackView()
|
||||
_nameStackView.axis = .horizontal
|
||||
_nameStackView.distribution = .fill
|
||||
_nameStackView.alignment = .center
|
||||
_nameStackView.spacing = UIDevice.scaleWidth(width: 2)
|
||||
return _nameStackView
|
||||
}()
|
||||
private lazy var vipImageView:UIImageView = {
|
||||
let _vipImageView = UIImageView()
|
||||
_vipImageView.image = UIImage(named: "1")
|
||||
return _vipImageView
|
||||
}()
|
||||
private lazy var nameView:UILabel = {
|
||||
let _nameView = UILabel.getCustomLabel(text: "我:", font: UIFont.getScaleFont(ofSize: 12, weight: .regular), color: ThemeColor(hexStr: "#FFFFFF", alpha: 0.5))
|
||||
|
||||
return _nameView
|
||||
}()
|
||||
private lazy var bgTextView:UIView = {
|
||||
let _bgTextView = UIImageView()
|
||||
_bgTextView.backgroundColor = ThemeColor(hexStr: "#FFFFFF", alpha: 0.2)
|
||||
|
||||
return _bgTextView
|
||||
}()
|
||||
|
||||
private lazy var textView:UILabel = {
|
||||
let _textView = UILabel.getCustomLabel(text:"或呃呃或呃呃或呃呃或呃呃",font: UIFont.getScaleFont(ofSize: 12, weight: .regular),numberOfLines: 0)
|
||||
_textView.isUserInteractionEnabled = true
|
||||
return _textView
|
||||
}()
|
||||
|
||||
private lazy var tagStackView:UIStackView = {
|
||||
let _tagStackView = UIStackView()
|
||||
_tagStackView.axis = .horizontal
|
||||
_tagStackView.distribution = .fill
|
||||
_tagStackView.alignment = .center
|
||||
_tagStackView.spacing = UIDevice.scaleWidth(width: 4)
|
||||
return _tagStackView
|
||||
}()
|
||||
|
||||
private lazy var experIconView:UIImageView = {
|
||||
let _experView = UIImageView()
|
||||
_experView.image = UIImage(named: "2")
|
||||
return _experView
|
||||
}()
|
||||
private lazy var charmIconView:UIImageView = {
|
||||
let _charmView = UIImageView()
|
||||
_charmView.image = UIImage(named: "2")
|
||||
return _charmView
|
||||
}()
|
||||
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// RoomChatScreenView.swift
|
||||
// yinmeng-ios
|
||||
//
|
||||
// Created by duoban on 2024/3/8.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class RoomChatScreenView: UIView {
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
setUILayout()
|
||||
registerCell()
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
private func setUILayout(){
|
||||
addSubview(chatTableView)
|
||||
chatTableView.snp.makeConstraints { make in
|
||||
make.leading.equalTo(UIDevice.scaleWidth(width: 15))
|
||||
make.top.bottom.right.equalTo(self)
|
||||
}
|
||||
|
||||
}
|
||||
private func registerCell(){
|
||||
chatTableView.delegate = self
|
||||
chatTableView.dataSource = self
|
||||
chatTableView.tableHeaderView = tableHeaderView
|
||||
chatTableView.register(RoomChatScreenUserChatCell.self, forCellReuseIdentifier: "RoomChatScreenUserChatCell")
|
||||
}
|
||||
|
||||
|
||||
|
||||
//MARK: - 懒加载
|
||||
private lazy var chatTableView:UITableView = {
|
||||
let _chatTableView = UITableView(frame: .zero, style: .plain)
|
||||
_chatTableView.tableFooterView = UIView()
|
||||
_chatTableView.separatorStyle = .none
|
||||
_chatTableView.backgroundColor = .clear
|
||||
_chatTableView.showsVerticalScrollIndicator = false
|
||||
_chatTableView.tag = 888
|
||||
|
||||
|
||||
return _chatTableView
|
||||
}()
|
||||
private lazy var tableHeaderView:RoomChatScreenHeaderView = {
|
||||
let _tableHeaderView = RoomChatScreenHeaderView(frame: .zero)
|
||||
|
||||
return _tableHeaderView
|
||||
}()
|
||||
}
|
||||
extension RoomChatScreenView:UITableViewDelegate,UITableViewDataSource{
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return 1
|
||||
}
|
||||
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
return 90
|
||||
}
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "RoomChatScreenUserChatCell", for: indexPath) as! RoomChatScreenUserChatCell
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -26,16 +26,14 @@ class RoomQuitView: UIView {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
private func setUILayout(){
|
||||
addSubview(dissBtn)
|
||||
|
||||
addSubview(bgMaskView)
|
||||
addSubview(collectionView)
|
||||
addSubview(textView)
|
||||
addSubview(tableView)
|
||||
|
||||
|
||||
dissBtn.snp.makeConstraints { make in
|
||||
make.edges.equalTo(self)
|
||||
}
|
||||
|
||||
bgMaskView.snp.makeConstraints { make in
|
||||
make.trailing.top.bottom.equalTo(self)
|
||||
make.width.equalTo(UIDevice.scaleWidth(width: 250))
|
||||
@@ -66,15 +64,9 @@ class RoomQuitView: UIView {
|
||||
tableView.dataSource = self
|
||||
}
|
||||
//MARK: - UIButtonTarget
|
||||
@objc func dissViewAction(){
|
||||
UIView.animate(withDuration: 0.1) {
|
||||
self.frame = CGRect(x: ScreenWidth, y: 0, width: ScreenWidth, height: ScreenHeight)
|
||||
}completion: { iscompletion in
|
||||
self.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - 懒加载
|
||||
let emptyCellHeight = ScreenHeight - StatusBarHeight - UIDevice.scaleWidth(width: 128)
|
||||
let emptyCellHeight = UIDevice.scaleWidth(width: 300)
|
||||
var delegate:RoomQuitViewProtocol?
|
||||
var clickModelList:[RoomQuitItemModel] {
|
||||
let quitModel = RoomQuitItemModel()
|
||||
@@ -87,13 +79,6 @@ class RoomQuitView: UIView {
|
||||
return [quitModel,reportModel]
|
||||
}
|
||||
var roomModelList:[RoomQuitModel] = []
|
||||
private lazy var dissBtn:UIButton = {
|
||||
let _dissBtn = UIButton()
|
||||
_dissBtn.addTarget(self, action: #selector(dissViewAction), for: .touchUpInside)
|
||||
|
||||
|
||||
return _dissBtn
|
||||
}()
|
||||
private lazy var bgMaskView:UIVisualEffectView = {
|
||||
var _bgMaskView = UIVisualEffectView()
|
||||
let blurEffect = UIBlurEffect(style: .dark)
|
||||
|
@@ -40,6 +40,7 @@ class RoomTopView: UIView {
|
||||
textStackView.addArrangedSubview(giftIconView)
|
||||
textStackView.addArrangedSubview(lockIconView)
|
||||
|
||||
addSubview(quitView)
|
||||
|
||||
superStackView.snp.makeConstraints { make in
|
||||
make.leading.equalTo(UIDevice.scaleWidth(width: 15))
|
||||
@@ -102,15 +103,17 @@ class RoomTopView: UIView {
|
||||
}
|
||||
}
|
||||
@objc func settingBntAction(){
|
||||
let quitView = RoomQuitView(frame: .zero)
|
||||
quitView.delegate = self
|
||||
quitView.frame = CGRect(x: ScreenWidth, y: 0, width: ScreenWidth, height: ScreenHeight)
|
||||
keyWindow.addSubview(quitView)
|
||||
UIView.animate(withDuration: 0.1) {
|
||||
quitView.frame = CGRect(x: 0, y: 0, width:ScreenWidth, height: ScreenHeight)
|
||||
}
|
||||
|
||||
let pop = FFPopup.init(contentView: quitView, showType: .slideInFromRight, dismissType: .slideOutToRight, maskType: FFPopup.MaskType.dimmed, dismissOnBackgroundTouch: true, dismissOnContentTouch: false)
|
||||
pop.show(layout: FFPopupLayout(horizontal: FFPopup.HorizontalLayout.right, vertical: FFPopup.VerticalLayout.center), duration:0)
|
||||
|
||||
}
|
||||
//MARK: - 懒加载
|
||||
private lazy var quitView:RoomQuitView = {
|
||||
let _quitView = RoomQuitView(frame: CGRect(x: ScreenWidth, y: 0, width: UIDevice.scaleWidth(width: 250), height: ScreenHeight))
|
||||
|
||||
return _quitView
|
||||
}()
|
||||
private lazy var settingBnt:UIButton = {
|
||||
let _settingBtn = UIButton.getCustomBtn(image: UIImage(named: "yin_room_top_right"))
|
||||
_settingBtn.setBtnClickRadius = UIEdgeInsets(top: 8, left: 8, bottom: 8, right: 8)
|
||||
|