tencent cloud

User Generated Short Video SDK

iOS

Download
フォーカスモード
フォントサイズ
最終更新日: 2026-05-11 17:46:57

Feature Overview

TAVWidgetContentView is the view for all widgets (stickers, PIP, and other components, collectively referred to as widgets) gesture operation view. Operations such as widget selection, deselection, dragging, drag position interception, and rotation angle interception can all be performed in this class.

Related Interface Classes

Interface Class Name
Description
TAVEditor
SDK operation entry class.
SDK gesture operation base class.
There are currently two built-in basic editing views that can be directly mounted in TAVWidgetContentView:
PIP basic editing view: TAVPipView
Sticker basic editing view: TAVStickerView
Widget borders and action buttons are drawn in the corresponding EditView. You can inherit from the corresponding EditView to draw different editing frames for different widgets.

Main Delegate Protocols

Interface Name
Description
Delegate to determine whether sticker and PIP touches should respond.
Delegate for sticker editing view operation responses.
Factory for creating custom widget editing views.

TAVWidgetContentViewDelegate

Name
Description
contentView:shouldTouchSticker:
Ask the delegate whether the sticker is allowed to respond to touch.
contentView:ShouldTouchPipItem:
Ask the delegate whether the PIP is allowed to respond to touch.

TAVStickerViewDelegate

Name
Description
stickerViewDidReachToEnd:
Notify delegate that sticker playback has ended.
stickerView:shouldHideAtTime:
Ask the delegate whether the sticker should be hidden at the current time.
stickerViewStartPanning:
Notify delegate that sticker started panning.
stickerViewChangePanning:
Notify delegate that sticker is changing panning.
stickerViewEndPanning:
Notify delegate that sticker ended panning.
stickerViewOnDelete:
Notify delegate that sticker was deleted.
stickerViewOnClicked:
Notify delegate that sticker was tapped.

TAVPipViewDelegate

Name
Description
pipView:shouldHideAtTime:
Ask the delegate whether the PIP should be hidden at the current time.
pipViewStartPanning:
Notify delegate that PIP started panning.
pipViewChangePanning:
Notify delegate that PIP is changing panning.
pipViewEndPanning:
Notify delegate that PIP ended panning.
pipViewOnDelete:
Notify delegate that PIP was deleted.
pipViewOnClicked:
Notify delegate that PIP was tapped.

TAVWidgetContentView

Name
Description
activeView
The currently active view.
isNoFocusGestureEnabled
Set whether widgets can be dragged directly without selecting them first.
registerDelegate:
Register delegate.
unregisterDelegate:
Unregister delegate.
filterStickerWithPoint:
Return all valid stickers at the tap location.
filterPipItemWithPoint:
Return all valid PIP items (PipItem) at the tap location.

Custom Views

Extend view functionality by inheriting from existing TAVWidgetContentView/TAVPipView/TAVStickerView.

Custom TAVWidgetContentView Example

// Inherit and extend TAVWidgetContentView
@interface MYWidgetContentView : TAVWidgetContentView
@property (nonatomic, weak) TAVEditor *editor;

@end


@implementation MYWidgetContentView

- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setupUI];
}
return self;
}

- (void)setupUI {
// Custom UI
}
@end

Custom StickerView Example


// Inherit and extend TAVStickerView
@interface MyStickerView : TAVStickerView
// Add an edit button
@property (nonatomic, strong, readonly) UIButton *editButton;


@end

@implementation MyStickerView

- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setupUI];
}
return self;
}

- (void)setupUI
{
_editButton = [UIButton buttonWithType:UIButtonTypeCustom];
_editButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
[_editButton setImage:[UIImage imagedName:@"icon_pip_edit"] forState:UIControlStateNormal];
[_editButton addTarget:self action:@selector(didClickEditItem) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_editButton];
}

// Override interface to customize hiding buttons when dragging view
- (void)handlePanRecognizer:(UIPanGestureRecognizer *)recognizer {
[super handlePanRecognizer:recognizer];
[self handleRecognizer:recognizer];
}

- (void)handleRecognizer:(UIGestureRecognizer *)recognizer {
switch (recognizer.state) {
case UIGestureRecognizerStateBegan:
self.editButton.hidden = YES;
break;
case UIGestureRecognizerStateChanged:
self.editButton.hidden = YES;
break;
case UIGestureRecognizerStateCancelled:
case UIGestureRecognizerStateEnded:
case UIGestureRecognizerStateFailed:
{
self.editButton.hidden = NO;
break;
}
default:
break;
}
}
@end



ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック