All Projects → ripperhe → Zytagview

ripperhe / Zytagview

Licence: mit
仿微博图片添加标签

Projects that are alternatives of or similar to Zytagview

Notgif
Play & Share your GIFs in Photos
Stars: ✭ 84 (-45.1%)
Mutual labels:  tag
Publish Nuget
📦 GitHub action to automate publishing NuGet packages when project version changes
Stars: ✭ 109 (-28.76%)
Mutual labels:  tag
Weibo Topic Spider
微博超级话题爬虫,微博词频统计+情感分析+简单分类,新增肺炎超话爬取数据
Stars: ✭ 128 (-16.34%)
Mutual labels:  weibo
Ssm Demo
基于Spring+SpringMVC+Mybatis+Bootstrap的模仿微博系统 🔥🌀🚀
Stars: ✭ 93 (-39.22%)
Mutual labels:  weibo
Music Metadata Browser
Browser version of music-metadata parser Supporting a wide range of audio and tag formats.
Stars: ✭ 105 (-31.37%)
Mutual labels:  tag
Decryptlogin
APIs for loginning some websites by using requests.
Stars: ✭ 1,861 (+1116.34%)
Mutual labels:  weibo
Sonataclassificationbundle
Symfony SonataClassificationBundle
Stars: ✭ 76 (-50.33%)
Mutual labels:  tag
Browser Id3 Writer
Pure JS library for writing ID3 tag to MP3 files in browsers and Node.js ✍️
Stars: ✭ 132 (-13.73%)
Mutual labels:  tag
Wecase
The Linux Sina Weibo Client
Stars: ✭ 108 (-29.41%)
Mutual labels:  weibo
Sina Weibo Album Downloader
Multithreading download all HD photos / pictures from someone's Sina Weibo album.
Stars: ✭ 125 (-18.3%)
Mutual labels:  weibo
Github Tag Action
A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. Works on any platform.
Stars: ✭ 98 (-35.95%)
Mutual labels:  tag
React Native Segmented Text Input
A wickedly customizable <TextInput /> for React Native. Useful for tags, spellchecking, whatever.
Stars: ✭ 104 (-32.03%)
Mutual labels:  tag
Sinaweibo Emotion Classification
新浪微博情感分析应用
Stars: ✭ 118 (-22.88%)
Mutual labels:  weibo
Tag Manager
Free Open Source Matomo Tag Manager - A simple way to manage and maintain all of your (third-party) tags on your website.
Stars: ✭ 91 (-40.52%)
Mutual labels:  tag
Weibo v6
适用于 Stylus 等插件的微博美化样式
Stars: ✭ 129 (-15.69%)
Mutual labels:  weibo
Weibo Album Crawler
新浪微博相册大图多线程爬虫。
Stars: ✭ 83 (-45.75%)
Mutual labels:  weibo
Weibo hot search
微博爬虫:每天定时爬取微博热搜榜的内容,留下互联网人的记忆。
Stars: ✭ 113 (-26.14%)
Mutual labels:  weibo
Gh Release
Create a github release for a node package.
Stars: ✭ 132 (-13.73%)
Mutual labels:  tag
Weibo image uploader
PHP 实现的微博图床上传轮子
Stars: ✭ 129 (-15.69%)
Mutual labels:  weibo
Yaofang
药方 YAWF 火狐扩展 新浪微博 微博过滤版面改造和美化等
Stars: ✭ 120 (-21.57%)
Mutual labels:  weibo

ZYTagView

公司的项目需要这个功能,写了之后顺便提取出来写了一个 demo,简单实现图片添加标签,暂时没有去处理图片宽度小于标签长度的情况。

效果图

类介绍

主要有三个类

  1. ZYTagImageView

    继承自 UIImageView ,主要处理其上的所有标签

  2. ZYTagView

    继承自 UIView ,标签视图,处理标签的各种手势,并利用代理进行回调

  3. ZYTagInfo

    继承自 NSObject,存储标签的信息,可存储具体位置以及当前点在父视图的位置比例(建议使用位置比例,在不同尺寸的屏幕上才能正常显示)

一个 ZYTagImageView 可以添加多个 ZYTagView,每个 ZYTagView 对应着一个 ZYTagInfo,所有标签位置信息均存储在 ZYTagInfo 中。

标签交互

类似微博的图片添加标签分为两种状态,一种是编辑标签状态,另一种是微博发出之后浏览其他人添加的标签的浏览状态。

编辑状态

添加标签拖动交互主要有以下几个点:

  1. 拖动边界控制

    根据圆点的位置进行限制拖动

  2. 边界标签方向翻转

    在拖动手势状态为 UIGestureRecognizerStateEnded 时候,检测是否能够放下删除按钮,不能则进行反向

  3. 轻触显示与隐藏删除按钮

    默认轻触标签显示和隐藏删除按钮,此时重新布局标签子控件位置;在拖动手势开始的时候,隐藏删除按钮

  4. 长按编辑标签

    遵守代理,即可获取到当前标签数据,进行修改

  5. 闪烁动画

    利用一个帧动画简单实现闪烁,根据传入的 repeatCount 决定动画闪烁多久

预览状态

供他人浏览,不可编辑,利用代理模式回调标签的轻触和长按手势。

简单使用

导入 #import "ZYTagImageView.h"

初始化 ZYTagImageView

ZYTagImageView *imageView = [[ZYTagImageView alloc] initWithImage:image];
imageView.delegate = self;
imageView.frame = CGRectMake(100, 100, 100, 100);
[self.view addSubview:imageView];

添加一个标签

[imageView addTagWithTitle:@"我是一个标签" point:CGPointMake(30, 40) object:nil];

删除所有标签

[imageView removeAllTags];

设置为预览模式

[imageView setAllTagsEditEnable:NO];

自定义手势处理,需遵守 ZYTagImageViewDelegate,实现以下代理方法

/** 轻触imageView空白区域 */
- (void)tagImageView:(ZYTagImageView *)tagImageView activeTapGesture:(UITapGestureRecognizer *)tapGesture;
/** 轻触标签 */
- (void)tagImageView:(ZYTagImageView *)tagImageView tagViewActiveTapGesture:(ZYTagView *)tagView;
/** 长按标签 */
- (void)tagImageView:(ZYTagImageView *)tagImageView tagViewActiveLongPressGesture:(ZYTagView *)tagView;

更多用法下载 demo 查看~

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].