更新时间:2024-07-30 GMT+08:00

会议页面顶部titlebar菜单定制

buildTitleBarPopViewItems

接口描述

该接口用于构建会议titleBar点击的弹出菜单。

图1 会议页面顶部titlebar菜单定制位置

注意事项

  1. 主持人密码只有主持人可见。其它定制菜单,所有人显示一致。
  2. 自定义cell时需要遵循HWMInMeetingCellDelegate(只修改默认顺序不需要遵循代理)

方法定义

1
2
3
4
5
6
7
8
9
- (NSArray <HWMInMeetingCellModel *> *)buildTitleBarPopViewItems;

// 自定义cll使用以下,遵循HWMInMeetingCellDelegate
/// cell 对象代理
/// @param cellType cellType
- (UITableViewCell *)cellForRowWithCellType:(HWMConfInfoCellType)cellType inTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath;
/// cell点击事件代理
/// @param cellType cellType
- (void)cellSelectedWithCellType:(HWMConfInfoCellType)cellType;

参数描述

返回值

示例代码

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/// 构建会议titleBar 点击的弹出菜单
- (NSArray <HWMInMeetingCellModel *> *)buildTitleBarPopViewItems{
    HWMInMeetingCellModel *subjectCell = [HWMInMeetingCellModel defaultSubjectCell];
    HWMInMeetingCellModel *encryptCell = [HWMInMeetingCellModel defaultEncryptedCell];
    HWMInMeetingCellModel *confIdCell = [HWMInMeetingCellModel defaultConfIdCell];
    HWMInMeetingCellModel *generalPasswordCell = [HWMInMeetingCellModel defaultGeneralPasswordCell];
    HWMInMeetingCellModel *hostPasswordCell = [HWMInMeetingCellModel defaultHostPasswordCell];
    HWMInMeetingCellModel *lockCell = [HWMInMeetingCellModel defaultConfLockCell];
    HWMInMeetingCellModel *qosCell = [HWMInMeetingCellModel defaultQosCell];
 
    return @[subjectCell,encryptCell, confIdCell, generalPasswordCell, hostPasswordCell, lockCell, qosCell];
}
/// cell 对象代理,高度自适应(需要添加自动行高所需的布局约束),根据需求自定义cell显示,以下为示例代码仅供参考
/// @param cellType cellType
- (UITableViewCell *)cellForRowWithCellType:(HWMConfInfoCellType)cellType inTableView:(nonnull UITableView *)tableView indexPath:(nonnull NSIndexPath *)indexPath{
    NSString *reuseIdentifier = [NSString stringWithFormat:@"CustomCell_%ld", cellType];
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    }
    cell.contentView.backgroundColor = [UIColor clearColor];
    cell.backgroundColor = [UIColor clearColor];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    UIImageView * safeImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"custom_conf_setting"]];
    [cell.contentView addSubview:safeImg];
    
    UILabel * safeLabel = [[UILabel alloc] init];
    safeLabel.font = [UIFont systemFontOfSize:14];
    safeLabel.textColor = [UIColor whiteColor];
    safeLabel.text = reuseIdentifier;
    [cell.contentView addSubview:safeLabel];
    [safeImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16);
        make.size.mas_equalTo(CGSizeMake(16, 16));
        make.centerY.mas_equalTo(safeLabel);
    }];
    
    [safeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(safeImg.mas_right).offset(10);
        make.top.mas_equalTo(10);
        make.height.mas_equalTo(34);
        make.bottom.mas_equalTo(-10);
    }]; 
    return cell;
}
 
/// cell点击事件代理
/// @param cellType cellType
- (void)cellSelectedWithCellType:(HWMConfInfoCellType)cellType{
    [UIUtil showMessage:[NSString stringWithFormat:@"点击了菜单:%lu", (unsigned long)cellType]];
}