TUIMenuView.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Created by Tencent on 2023/06/09.
  2. // Copyright © 2023 Tencent. All rights reserved.
  3. /**
  4. * This file declares the components used to implement the emoji menu view.
  5. * The emoji menu view, the bright white view at the bottom of the emoji view, is responsible for displaying individual emoji groups and their thumbnails, and
  6. * providing a "Send" button.
  7. *
  8. * The TUIMenuViewDelegate protocol provides the emoticon menu view with event callbacks for sending messages and cell selection.
  9. * The TUIMenuView class, the "ontology" of the emoticon menu view, is responsible for displaying it in the form of a view in the UI, and at the same time
  10. * serving as a "container" for each component. You can switch between different groups of emoticons or send emoticons through the emoticon menu view.
  11. */
  12. #import <UIKit/UIKit.h>
  13. #import "TUIMenuCellData.h"
  14. @class TUIMenuView;
  15. /////////////////////////////////////////////////////////////////////////////////
  16. //
  17. // TUIMenuViewDelegate
  18. //
  19. /////////////////////////////////////////////////////////////////////////////////
  20. @protocol TUIMenuViewDelegate <NSObject>
  21. /**
  22. * Callback after clicking on a specific menuCell
  23. * You can use this callback to achieve: in response to the user's click, switch to the corresponding emoticon group view according to the menuCell selected by
  24. * the user.
  25. */
  26. - (void)menuView:(TUIMenuView *)menuView didSelectItemAtIndex:(NSInteger)index;
  27. /**
  28. * Callback after click of send button on menuView
  29. * You can send the content of the current input box (TUIInputBar) through this callback
  30. * In the default implementation of TUIKit, the delegate call chain is menuView -> inputController -> messageController.
  31. * Call the sendMessage function in the above classes respectively, so that the functions are reasonably layered and the code reuse rate is improved.
  32. */
  33. - (void)menuViewDidSendMessage:(TUIMenuView *)menuView;
  34. @end
  35. /////////////////////////////////////////////////////////////////////////////////
  36. //
  37. // TUIMenuView
  38. //
  39. /////////////////////////////////////////////////////////////////////////////////
  40. ///
  41. @interface TUIMenuView : UIView
  42. @property(nonatomic, strong) UICollectionView *menuCollectionView;
  43. @property(nonatomic, strong) UICollectionViewFlowLayout *menuFlowLayout;
  44. @property(nonatomic, weak) id<TUIMenuViewDelegate> delegate;
  45. - (void)scrollToMenuIndex:(NSInteger)index;
  46. - (void)setData:(NSMutableArray<TUIMenuCellData *> *)data;
  47. @end