Skip to content

Commit

Permalink
Add PBImageView
Browse files Browse the repository at this point in the history
  • Loading branch information
galenlin committed Mar 26, 2017
1 parent 6aebd26 commit 74e926a
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 5 deletions.
11 changes: 7 additions & 4 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -25,7 +28,7 @@ SPEC CHECKSUMS:
FBSnapshotTestCase: 918c55861356ee83aee7843d759f55a18ff6982b
Kiwi: f49c9d54b28917df5928fe44968a39ed198cb8a8
Pbind: faa44504244a1dd3d8d48ea91ee67b8196c7133c
PBKit: cf13073c970da6c07ddbc72a2eaf8189122a639b
PBKit: dbae6481580bb6a6b3eea1912f32fdffe27b2885

PODFILE CHECKSUM: a6bcf07fe54bc3a829b3e066e44e649d0bd6df3d

Expand Down
7 changes: 6 additions & 1 deletion PBKit.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Empty file removed PBKit/Classes/.gitkeep
Empty file.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions PBKit/PBImageView/PBImageView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// PBImageView.h
// Pods
//
// Created by Galen Lin on 27/03/2017.
//
//

#import <UIKit/UIKit.h>

@interface PBImageView : UIImageView

@property (nonatomic, assign) BOOL rounded;

@end
35 changes: 35 additions & 0 deletions PBKit/PBImageView/PBImageView.m
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 74e926a

Please sign in to comment.