TUIMenuView Class Reference

Inherits from UIView
Declared in TUIMenuView.h
TUIMenuView.m

Overview

【模块名称】TUIMenuView 【功能说明】用于实现聊天窗口中的表情菜单视图。 表情菜单视图,即在表情视图最下方的亮白色视图。 本视图负责显示各个表情分组及其缩略图,方便您快速在各个表情分组中切换,并提供“发送”按钮。 您可以通过表情菜单视图在不同组别的表情下切换,或是发送表情。

Other Methods

– initWithFrame:

- (id)initWithFrame:(CGRect)frame

– setData:

设置表情菜单数据 data 数组中存放对象类型为 TMenuCellData,即 MenuCell 的数据源。

- (void)setData:(NSMutableArray *)data

Parameters

data

需要设置的数据

Declared In

TUIMenuView.h

– setupViews

- (void)setupViews

– defaultLayout

- (void)defaultLayout

– sendUpInside:

- (void)sendUpInside:(UIButton *)sender

– collectionView:numberOfItemsInSection:

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section

– collectionView:cellForItemAtIndexPath:

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath

– collectionView:didSelectItemAtIndexPath:

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath

– collectionView:layout:sizeForItemAtIndexPath:

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath

– scrollToMenuIndex:

滑动到某一索引菜单的回调函数 通常情况下:设置cell状态与图标跟随滑动一同改变。 您可以根据需求进行个性化实现。

- (void)scrollToMenuIndex:(NSInteger)index

Parameters

index

索引值

Declared In

TUIMenuView.h

Other Methods

  sendButton

发送按钮 即在 muewView 最右侧的“发送”按钮。

@property (nonatomic, strong) UIButton *sendButton

Declared In

TUIMenuView.h

  menuCollectionView

表情菜单视图的collectionView 包含多个 menuCell,并通过 menuFlowLayout 进行灵活统一的布局。

@property (nonatomic, strong) UICollectionView *menuCollectionView

Declared In

TUIMenuView.h

  menuFlowLayout

表情菜单 collectionView 的流水布局。 配合 menuCollectionView,维护表情菜单视图的布局,使表情排布更加美观。 您可以在本布局中能够设置布局方向、行间距、cell 间距等。

@property (nonatomic, strong) UICollectionViewFlowLayout *menuFlowLayout

Declared In

TUIMenuView.h

  delegate

被委托者,负责实现 TMenuViewDelegate 委托协议。

@property (nonatomic, weak) id<TMenuViewDelegate> delegate

Declared In

TUIMenuView.h

Extension Methods

  data

@property (nonatomic, strong) NSMutableArray *data