PPDragDropBadgeView是一個badge視圖帅容,可以進(jìn)行拖拽,像QQ5.0中的badge視圖箩言。
這里先附上鏈接:PPDragDropBadgeView
效果圖.gif
PPDragDropBadgeView好像不支持從cocopods上pod,只能把它先拉倒項(xiàng)目中去,再來配置相關(guān)文件.
以下是官方說明:
- 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.
看不懂?沒關(guān)系,我?guī)湍惴g.
1.從github上查詢PPDragDropBadgeView
2.將PPDragDropBadgeView文件夾拖到你的項(xiàng)目當(dāng)中
3.到'TARGET' -> 'Build Phases' -> 'Complile Sources'雕欺,添加編譯標(biāo)簽'-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";
這個是否支持更多參數(shù)的定制呢弱睦?
當(dāng)然,你可以設(shè)置“位置”渊额,“半徑”况木,“填充顏色”,“邊框?qū)挾取毖#斑吙蝾伾被鹁D阋部梢栽O(shè)置以下我提供的一些屬性。
/** 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;