objective-c – 什么原因类别正在实施一个也将由其主要类实现的方法?

我的其他程序员从网上下载这段代码
#import "UIImage+Alpha.h"

// Private helper methods
@interface UIImage ()
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size;
@end

@implementation UIImage (Alpha)

我有错误
什么原因是Category正在实现一个也将由其主类实现的方法

我在整个文件搜索newBorderMask,该单词只显示3次.

这只是宣布一次

@interface UIImage ()
- (CGImageRef)newBorderMask:(NSUInteger)borderSize size:(CGSize)size;
@end

执行一次即可

#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();

并呼吁一次

CGImageRef maskImageRef = [self newBorderMask:borderSize size:newRect.size];

所以没有双重的声明.

所以有什么问题.

解决方法

我是 code的原作者,而Aadhira的回答是错误的.此方法的类别名称不应更改为“Alpha”,因为该方法是私有的,而不是扩展的一部分.

为了摆脱警告,最好的解决方法是给私有类别一个唯一的名称,如“Privatealpha”.

有关详细信息,请参阅this discussion.

相关文章

本程序的编译和运行环境如下(如果有运行方面的问题欢迎在评...
水了一学期的院选修,万万没想到期末考试还有比较硬核的编程...
补充一下,先前文章末尾给出的下载链接的完整代码含有部分C&...
思路如标题所说采用模N取余法,难点是这个除法过程如何实现。...
本篇博客有更新!!!更新后效果图如下: 文章末尾的完整代码...
刚开始学习模块化程序设计时,估计大家都被形参和实参搞迷糊...