My other programmer download this code from the net
#import "UIImage+Alpha.h"
// Private helper methods
@interface UIImage ()
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size;
@end
@implementation UIImage (Alpha)
I got error: What causes Category is implementing a method which will also be implemented by its primary class?
I search for newBorderMask in my whole files and the word only show up 3 times.
It's only declared once namely on
@interface UIImage ()
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size;
@end
Implemented once namely in
#pragma mark -
#pragma mark Private helper methods
// Creates a mask that makes the outer edges transparent and everything else opaque
// The size must include the entire mask (opaque part + transparent border)
// The caller is responsible for releasing the returned reference by calling CGImageRelease
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size1 {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
and called once
CGImageRef maskImageRef = [self newBorderMask:borderSize size:newRect.size];
So there is no double declaration.
So what's the problem.
I am the original author of the code, and Aadhira's answer is incorrect. The category name for this method should not be changed to "Alpha", as the method is intended to be private and not part of the extension.
To get rid of the warning, the best workaround is to give the private category a unique name, such as "PrivateAlpha".
For more details, see this discussion.
See, while you declare the category, it is like
@interface UIImage ()
But in implementation, it is like
@implementation UIImage (Alpha)
So declare it as follows:
@interface UIImage (Alpha)
I just removed this whole bit from my .m file:
@interface UIImage ()
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size;
@end
LLVM 4.1 compiler doesn't seem to care about it anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With