diff --git a/Example/Podfile.lock b/Example/Podfile.lock index 16506d1..ad0e3a8 100644 --- a/Example/Podfile.lock +++ b/Example/Podfile.lock @@ -6,10 +6,13 @@ PODS: - FBSnapshotTestCase/Core - Kiwi (2.4.0) - Pbind (0.8.0) - - PBKit (0.1.1): + - PBKit (0.2.0): - Pbind - - PBKit/PBDropdownMenu (= 0.1.1) - - PBKit/PBDropdownMenu (0.1.1): + - PBKit/PBDropdownMenu (= 0.2.0) + - PBKit/PBImageView (= 0.2.0) + - PBKit/PBDropdownMenu (0.2.0): + - Pbind + - PBKit/PBImageView (0.2.0): - Pbind DEPENDENCIES: @@ -25,7 +28,7 @@ SPEC CHECKSUMS: FBSnapshotTestCase: 918c55861356ee83aee7843d759f55a18ff6982b Kiwi: f49c9d54b28917df5928fe44968a39ed198cb8a8 Pbind: faa44504244a1dd3d8d48ea91ee67b8196c7133c - PBKit: cf13073c970da6c07ddbc72a2eaf8189122a639b + PBKit: dbae6481580bb6a6b3eea1912f32fdffe27b2885 PODFILE CHECKSUM: a6bcf07fe54bc3a829b3e066e44e649d0bd6df3d diff --git a/PBKit.podspec b/PBKit.podspec index fc060c2..8c794d4 100644 --- a/PBKit.podspec +++ b/PBKit.podspec @@ -17,8 +17,13 @@ A group of UI components that using Pbind which can simply configure layout and # s.source_files = 'PBKit/Classes/**/*' s.subspec 'PBDropdownMenu' do |sub| - sub.source_files = 'PBKit/Classes/PBDropdownMenu/**/*' + sub.source_files = 'PBKit/PBDropdownMenu/**/*' end + s.subspec 'PBImageView' do |sub| + sub.source_files = 'PBKit/PBImageView/**/*' + end + + s.dependency 'Pbind' end diff --git a/PBKit/Classes/.gitkeep b/PBKit/Classes/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/PBKit/Classes/PBDropdownMenu/PBDropdownMenu.h b/PBKit/PBDropdownMenu/PBDropdownMenu.h similarity index 100% rename from PBKit/Classes/PBDropdownMenu/PBDropdownMenu.h rename to PBKit/PBDropdownMenu/PBDropdownMenu.h diff --git a/PBKit/Classes/PBDropdownMenu/PBDropdownMenu.m b/PBKit/PBDropdownMenu/PBDropdownMenu.m similarity index 100% rename from PBKit/Classes/PBDropdownMenu/PBDropdownMenu.m rename to PBKit/PBDropdownMenu/PBDropdownMenu.m diff --git a/PBKit/PBImageView/PBImageView.h b/PBKit/PBImageView/PBImageView.h new file mode 100644 index 0000000..d97842e --- /dev/null +++ b/PBKit/PBImageView/PBImageView.h @@ -0,0 +1,15 @@ +// +// PBImageView.h +// Pods +// +// Created by Galen Lin on 27/03/2017. +// +// + +#import + +@interface PBImageView : UIImageView + +@property (nonatomic, assign) BOOL rounded; + +@end diff --git a/PBKit/PBImageView/PBImageView.m b/PBKit/PBImageView/PBImageView.m new file mode 100644 index 0000000..9baf3be --- /dev/null +++ b/PBKit/PBImageView/PBImageView.m @@ -0,0 +1,35 @@ +// +// PBImageView.m +// Pods +// +// Created by Galen Lin on 27/03/2017. +// +// + +#import "PBImageView.h" + +@implementation PBImageView + +- (void)layoutSubviews { + [super layoutSubviews]; + if (self.rounded) { + self.layer.cornerRadius = self.bounds.size.width / 2; + } +} + +- (void)setRounded:(BOOL)rounded { + if (_rounded == rounded) { + return; + } + + if (rounded) { + self.clipsToBounds = YES; + [self setNeedsLayout]; + } else { + self.clipsToBounds = NO; + self.layer.cornerRadius = 0; + } + _rounded = rounded; +} + +@end