Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions PPBadgeView/objc/PPBadgeControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ NS_ASSUME_NONNULL_BEGIN
/// 记录Badge的偏移量 Record the offset of Badge
@property (nonatomic, assign) CGPoint offset;


/// 自定义角标Label CustomLabel
@property (nonatomic, strong) UILabel *textLabel;

@end

NS_ASSUME_NONNULL_END
1 change: 0 additions & 1 deletion PPBadgeView/objc/PPBadgeControl.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

@interface PPBadgeControl ()

@property (nonatomic, strong) UILabel *textLabel;
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UIColor *badgeViewColor;
@property (nonatomic, strong) NSLayoutConstraint *badgeViewHeightConstraint;
Expand Down
2 changes: 1 addition & 1 deletion PPBadgeView/swift/PPBadgeControl.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ open class PPBadgeControl: UIControl {
/// Badge伸缩的方向, Default is PPBadgeViewFlexModeTail
public var flexMode: PPBadgeViewFlexMode = .tail

private lazy var textLabel: UILabel = UILabel()
public lazy var textLabel: UILabel = UILabel()

private lazy var imageView: UIImageView = UIImageView()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ class PPViewController2: UIViewController {
testView.pp.addBadge(number: 10)
view.addSubview(testView)

let testView2 = UIView(frame: CGRect(x: 100, y: 250, width: 100, height: 100))
testView2.backgroundColor = UIColor.blue
testView2.pp.badgeView.textLabel.text = "哈哈"
testView2.pp.badgeView.textLabel.font = UIFont.systemFont(ofSize: 10)
testView2.pp.setBadge(height: 15)
view.addSubview(testView2)

let testView3 = UIView(frame: CGRect(x: 100, y: 400, width: 100, height: 100))
testView3.backgroundColor = UIColor.blue
let attStr = NSAttributedString.init(string: "hello")
testView3.pp.badgeView.textLabel.attributedText = attStr
view.addSubview(testView3)

}

override func didReceiveMemoryWarning() {
Expand Down