小编rei*_*d55的帖子

如何删除作为另一个对象一部分的NSMutableArray上的AllObjects?

我有一个像这样定义的对象:Scores.h:

@interface Scores : NSObject {
NSString *sentenceKey;
    NSMutableArray *scorrectAnswers;
}
@property (nonatomic, copy) NSString *sentenceKey;
@property (nonatomic, copy) NSMutableArray *scorrectAnswers;
+ (id)addScore:(NSString *)senKey;

- (id)initWithSentenceKey:(NSString *)sKey  
    scorrectAnswers:(NSMutableArray *)scorrectAs;

- (id)initWithSentenceKey:(NSString *)sKey;
- (void)removeArrayObjects;
Run Code Online (Sandbox Code Playgroud)

Score.m:

#import "Scores.h"
@implementation Scores

@synthesize sentenceKey, scorrectAnswers;

+ (id)addScore:(NSString *)senKey
{
Scores *newScore = [[self alloc] initWithSentenceKey:senKey
                    scorrectAnswers:[NSMutableArray new]];
return [newScore autorelease];}
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用此方法删除可变数组上的AllObjects:

- (void)removeArrayObjects;{
   [scorrectAnswers removeAllObjects];}
Run Code Online (Sandbox Code Playgroud)

...我从另一个程序中调用这样的:

for (Scores *sScore in scores)
{   
    [sScore removeArrayObjects];
}
Run Code Online (Sandbox Code Playgroud)

...当我运行它时,我收到此错误:

- [__ NSArrayI removeAllObjects]:无法识别的选择器发送到实例0x53412d0

谁能告诉我这里我做错了什么?谢谢.

iphone nsmutablearray

2
推荐指数
1
解决办法
6818
查看次数

有没有办法在UIButton上只有一个圆角?

在UIButton上,我知道如何创建4个圆角,我知道如何创建4个方角,但现在我需要的是一种创建具有3个方角和1个圆角的UIButton的方法.有没有办法做到这一点?谢谢.

iphone uibutton

0
推荐指数
1
解决办法
3370
查看次数

标签 统计

iphone ×2

nsmutablearray ×1

uibutton ×1