PPDragDropBadgeView是一个badge视图,可以进行拖拽,像QQ5.0中的badge视图。
这里先附上链接:PPDragDropBadgeView
PPDragDropBadgeView好像不支持从cocopods上pod,只能把它先拉倒项目中去,再来配置相关文件.
以下是官方说明:
- Checkout PPDragDropBadgeView from github.
- Copy PPDragDropBadgeView folder to your project.
- Go to 'TARGET' -> 'Build Phases' -> 'Complile Sources', add compliler flags '-fno-objc-arc' for 'PRTween.m' and 'PRTweenTimingFunctions.m'
Done. - You can also refer to the example project provided by me.
看不懂?没关系,我帮你翻译.
1.从github上查询PPDragDropBadgeView
2.将PPDragDropBadgeView文件夹拖到你的项目当中
3.到'TARGET' -> 'Build Phases' -> 'Complile Sources',添加编译标签'-fno-objc-arc'到 'PRTween.m' 与 'PRTweenTimingFunctions.m' 中
怎么使用PPDragDropBadgeView?
非常简单,用下面的代码片段即可。
PPDragDropBadgeView* badgeView \
= [[PPDragDropBadgeView alloc] initWithSuperView:self.testView
location:CGPointMake(0,0)
radius:10.0f dragdropCompletion:^{
NSLog(@"Drag drop done.");
}];
badgeView.text = @"6";
这个是否支持更多参数的定制呢?
当然,你可以设置“位置”,“半径”,“填充颜色”,“边框宽度”,“边框颜色”。你也可以设置以下我提供的一些属性。
/** The location of badge view. */
@property (nonatomic, assign) CGPoint location;
/** The radius of badge view. */
@property (nonatomic, assign) CGFloat radius;
/** The completion block when drag drop done. */
@property (nonatomic, copy) void(^dragdropCompletion)();
/** The tint color of badge view. Default is red */
@property (nonatomic, strong) UIColor* tintColor;
/** The border color of badge view. Default is clear */
@property (nonatomic, strong) UIColor* borderColor;
/** The border width of badge view. Default is 1.0f */
@property (nonatomic, assign) CGFloat borderWidth;
/** The text of badge view. */
@property (nonatomic, strong) NSString* text;