错误的接收器类型UIRectEdge和多个方法命名 [英] Bad receiver type UIRectEdge and Multiple methods named

查看:208
本文介绍了错误的接收器类型UIRectEdge和多个方法命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从磁盘恢复此代码并尝试在xcode 5.0.2上为ios构建它。
在xcode 4中,此代码有效,但实际上并非如此:

I recover this code from disk and try build it on xcode 5.0.2 for ios. In xcode 4 this code work but actually not:

else {


    for (int i=0;i<pieceNumber;i++){

        for (int j=0;j<pieceNumber;j++){

            CGRect rect = CGRectMake( 0, 0, SHAPE_QUALITY*piceSize, SHAPE_QUALITY*piceSize);

            PieceView *piece = [[PieceView alloc] initWithFrame:rect];
            piece.delegate = self;
            piece.image = [array objectAtIndex:j+pieceNumber*i];
            piece.number = j+pieceNumber*i;
            piece.size = piceSize;
            piece.position = -1;
            NSNumber *n = [NSNumber numberWithInt:NumberSquare];
            piece.neighbors = [[NSArray alloc] initWithObjects:n, n, n, n, nil];

            //piece.frame = rect;


            NSMutableArray *a = [[NSMutableArray alloc] initWithCapacity:4];

            for (int k=0; k<4; k++) {
                int e = arc4random_uniform(3)+1;

                if (arc4random_uniform(2)>0) {
                    e *= -1;
                }

                [a addObject:[NSNumber numberWithInt:e]];
            }

            if (i>0) {
                int l = [arrayPieces count]-pieceNumber;
                int e = [[[[arrayPieces objectAtIndex:l] edges] objectAtIndex:1] intValue];
                [a replaceObjectAtIndex:3 withObject:[NSNumber numberWithInt:-e]];
                //DLog(@"e = %d", e);
            }

            if (j>0) {
                int e = [[[[arrayPieces lastObject] edges] objectAtIndex:2] intValue];
                [a replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:-e]];
                //DLog(@"e = %d", e);
            }

            if (i==0) {
                [a replaceObjectAtIndex:3 withObject:[NSNumber numberWithInt:0]];
            }
            if (i==pieceNumber-1) {
                [a replaceObjectAtIndex:1 withObject:[NSNumber numberWithInt:0]];
            }
            if (j==0) {
                [a replaceObjectAtIndex:0 withObject:[NSNumber numberWithInt:0]];
            }
            if (j==pieceNumber-1) {
                [a replaceObjectAtIndex:2 withObject:[NSNumber numberWithInt:0]];
            }


            piece.edges = [NSArray arrayWithArray:a];                

            [arrayPieces addObject:piece];

        }
    }

} //end if loadingGame   

错误:

找到多个名为'edge'的方法,结果,参数类型或属性不匹配

Multiple methods named 'edges' found with mismatched result, parameter type or attributes

错误的收件人类型'UIRectEdge'(又名'enum UIRectEdge')

Bad receiver type 'UIRectEdge' (aka 'enum UIRectEdge')

有人可以帮助我?

问候,

UIRectEdge代码

Code with UIRectEdge

#import <UIKit/UIGeometry.h>
#import <UIKit/UIPanGestureRecognizer.h>

/*! This subclass of UIPanGestureRecognizer only recognizes if the user slides their finger
    in from the bezel on the specified edge. */
NS_CLASS_AVAILABLE_IOS(7_0) @interface UIScreenEdgePanGestureRecognizer : UIPanGestureRecognizer
@property (readwrite, nonatomic, assign) UIRectEdge edges; //< The edges on which this gesture recognizes, relative to the current interface orientation
@end

和边缘问题

//@property (nonatomic, assign) id<PieceViewProtocol> delegate;
@property (nonatomic, assign) PuzzleController *delegate;


@property(nonatomic, retain) NSArray *edges;
@property(nonatomic, retain) NSArray *neighbors;
@property(nonatomic, retain) UIImage *image;
@property(nonatomic, retain) UIView *centerView;
@property(nonatomic, retain) UIPanGestureRecognizer *pan;

@property(nonatomic, retain) GroupView *group;

@property(nonatomic) BOOL isPositioned;
@property(nonatomic) BOOL isLifted;
@property(nonatomic) BOOL isFree;
@property(nonatomic) BOOL isRotating;
@property(nonatomic) BOOL isBoss;
@property(nonatomic) BOOL hasNeighbors;

@property(nonatomic) CGPoint oldPosition;

@property(nonatomic) int number;
@property(nonatomic) int position;
@property(nonatomic) int positionInDrawer;
@property(nonatomic) int moves;
@property(nonatomic) int rotations;

@property(nonatomic) float angle;
@property(nonatomic) float size;
@property(nonatomic) float padding;
@property(nonatomic) float tempAngle;



- (void)move:(UIPanGestureRecognizer*)gesture;
- (void)rotate:(UIRotationGestureRecognizer*)gesture;
- (void)rotateTap:(UITapGestureRecognizer*)gesture;

- (id)initWithFrame:(CGRect)frame;
- (int)edgeNumber:(int)i;
- (void)setNeighborNumber:(int)i forEdge:(int)edge;
- (NSArray*)allTheNeighborsBut:(NSMutableArray*)excluded;
- (CGPoint)realCenter;
- (void)pulse;
- (BOOL)isCompleted;

@end


推荐答案

我猜你的项目最初来自 https://github.com/AndreaBarbon/Puzzle-iOS

I guess your project is originally from https://github.com/AndreaBarbon/Puzzle-iOS

我在Xcode 5.0.2中运行它所做的是搜索整个项目的边缘并用my_edges(没有引号)替换每个实例然后它工作。

What I did to get it running in Xcode 5.0.2 was to search the whole project for "edges" and replace every instance with "my_edges" (without quotes) and then it worked.

正如rmaddy指出的那样,边缘已被添加到iOS7中的uikit,这就是你得到错误的原因。

As rmaddy pointed out, "edges" has been added to the uikit in iOS7, that is why you get the error.

这篇关于错误的接收器类型UIRectEdge和多个方法命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆