SeatGridView
.SeatGridView
, you need to integrate and log in to SeatGridView to ensure the subsequent features work properly.SeatGridView
module first, then create a SeatGridView object and add it to your view.import UIKitimport RTCRoomEngineimport SeatGridViewclass CustomizeSeatViewController: UIViewController {private let seatGridView: SeatGridView = {let view = SeatGridView()self.seatGridView.setSeatViewDelegate(self)return view}override func viewDidLoad() {super.viewDidLoad()self.seatGridView.setSeatViewDelegate(self)// Add seatGridView to the view and set layout constraints}}
import com.trtc.uikit.livekit.seatGridView.SeatGridView;public class CustomizeSeatViewActivity extends AppCompatActivity {@Overrideprotected void onCreate(@Nullable Bundle savedInstanceState) {super.onCreate(savedInstanceState);SeatGridView seatGridView = new SeatGridView(this);addContentView(seatGridView,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));}}
SeatGridView
delegate SGSeatViewDelegate
.protocolSGSeatViewDelegate
{func seatGridView(_ view: SeatGridView, createSeatView seatInfo: TUISeatInfo) -> UIView?func seatGridView(_ view: SeatGridView, updateSeatView seatInfo: TUISeatInfo, seatView: UIView)func seatGridView(_ view: SeatGridView, updateUserVolume volume: Int, seatView: UIView)}
extension CustomizeSeatViewController:SGSeatViewDelegate
{
func seatGridView(_ view: SeatGridView, createSeatView seatInfo: TUISeatInfo) -> UIView? {
return CustomSeatView(seatInfo: seatInfo)}func seatGridView(_ view: SeatGridView, updateSeatView seatInfo: TUISeatInfo, seatView: UIView) {if let seatView = seatView as? CustomSeatView {seatView.updateSeatView(withSeatInfo: seatInfo)}}func seatGridView(_ view: SeatGridView, updateUserVolume volume: Int, seatView: UIView) {if let seatView = seatView as? CustomSeatView {seatView.updateSeatView(withVolume: volume)}}}
// Please replace with your SeatView
class
CustomSeatView
:
UIView
{
var seatInfo: TUISeatInfo = TUISeatInfo()var volume: Int = 0// ... UIinit(seatInfo: TUISeatInfo) {self.seatInfo = seatInfo}required init?(coder: NSCoder) {fatalError("init(coder:) has not been implemented")}func updateSeatView(withSeatInfo seatInfo: TUISeatInfo) {self.seatInfo = seatInfo// ...}func updateSeatView(withVolume volume: Int) {self.volume = volume// ...}}
SeatGridView
adapter SeatViewAdapter
.public interface SeatViewAdapter {View createSeatView(SeatGridView seatGridView, TUIRoomDefine.SeatInfo seatInfo);void updateSeatView(SeatGridView seatGridView, TUIRoomDefine.SeatInfo seatInfo, View seatView);void updateUserVolume(SeatGridView seatGridView, int volume, View seatView);}
seatGridView.setSeatViewAdapter(new VoiceRoomDefine.SeatViewAdapter() {@OverrideView createSeatView(SeatGridView seatGridView, TUIRoomDefine.SeatInfo seatInfo) {TextView seatUserName = new TextView(CustomizeSeatViewActivity.this);seatUserName.setText(seatInfo.userName);return seatUserName;}@Overridevoid updateSeatView(SeatGridView seatGridView, TUIRoomDefine.SeatInfo seatInfo, View seatView) {}@Overridevoid updateUserVolume(SeatGridView seatGridView, int volume, View seatView) {}});
Was this page helpful?