Skip to content

Commit

Permalink
Check for protocol conformance, not a specific method, before casting
Browse files Browse the repository at this point in the history
  • Loading branch information
cdzombak committed Nov 2, 2015
1 parent 7c59992 commit 162e0ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Pod/Classes/ios/NYTPhotosOverlayView.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ - (void)layoutSubviews {

[super layoutSubviews];

if ([self.captionView respondsToSelector:@selector(setPreferredMaxLayoutWidth:)]) {
if ([self.captionView conformsToProtocol:@protocol(NYTPhotoCaptionViewLayoutWidthHinting)]) {
[(id<NYTPhotoCaptionViewLayoutWidthHinting>) self.captionView setPreferredMaxLayoutWidth:self.bounds.size.width];
}
}
Expand Down

0 comments on commit 162e0ba

Please sign in to comment.