swift - ios 一个功能 页面设计和实现思路
怪我咯
怪我咯 2017-04-17 13:36:32
0
1
276

如图所示, 这个界面是一个视频会议的界面,最上面的窗口是自己的视频窗口,当开启摄像头时,会显示,下面的几个罗列的小窗口, 是其他人的视频窗口(希望是根据人数来动态调整窗口的大小), 如果其他人只开启声音,则只显示头像,如果开启视频则显示视频内容, 最下面的按钮是可以控制声音和视频的按钮。

现已有一个接受视频的接口,作用 : 当有人进入会议开始视频时,服务端会通知到这个接口
func remoteVideoViewWasReady(muxerID: String!, videoView: UIView!) videoView 就是返回的视频窗口内容。

我的思路是

  1. 用普通的view 然后每个视频区域也使用普通的view来填充, 当接收到视频时手动创建一个view 定义好指定的frame, 然后add到当前view上,
  2. 用CollectionView 自定义cell, 里面放view,我还在查看CollectionView相关的用法

存在的疑惑是

  1. 我怎么适应不同设备上的适配,因为是用代码控制添加的view,难道需要用代码来适配?我更喜欢用autolayout来控制
  2. 怎么样能根据人数来动态的计算view 的frame, 这块逻辑应该如何设计?

以上是我的问题, 有可能思路也不对,请大家指教,谢谢

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
洪涛

Use view or CollectionView

If the entire interface is fixed, the number and size of blocks are fixed, and scrolling is not required, you can consider writing directly in view. Otherwise it is recommended to use CollectionView. Generally speaking, it is recommended to use CollectionView, which is more flexible to change.

How do I adapt to the adaptation on different devices? Because the added view is controlled by code, do I need to use code to adapt?

Yes, if you use code to add it, you need to use code to adapt (you can also use code to add autoLayout constraints, but it is very cumbersome). Adapting with code is very simple and requires no extra effort. Just calculate the frame based on the superView's frame or screen size when setting the frame, instead of hard-coding it like "320".

How to dynamically calculate the frame of the view based on the number of people? This logic should also need to be controlled by code, right?

Yes. If you use collectionView, you only need to worry about the size of the cell, and you don't need to worry about the position. CollectionView will arrange the positions; if you arrange the views yourself, you can only use code. The position needs to be calculated row by row from top to bottom.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!