小编use*_*607的帖子

@property(readonly,retain)有意义吗?

XCode接受它.但是当我在内部设置属性时会保留应用(自从readonly以来没有setter,但是当我在类方法中初始化值时)?

此致,Apple92

properties objective-c readonly retain

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

证书结构

大多数签名证书足迹长度为20字节(Windows证书管理器中的字段"足迹").

这如何是由发行(认证)机构签署的价值?具体而言,证书的签名应该是由私钥签名的证书字段的散列值,因此至少具有发行者私钥的RSA模数长度(在RSA签名的情况下),因此...是至少512位(64字节)长.

我必须缺少一些东西......如果这个足迹只是一个哈希,那么它就不能是签名证书.证书签名实际上在哪里?无法从简单的哈希检查证书是否有效.

此致,Apple92

cryptography certificate footprint

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

是否有自动发布的setTitle(UIButton类)?

众所周知,setTitle会自动保留作为参数传递的字符串.当需要更改按钮标题时,我想在设置新字符串之前必须释放当前(旧)字符串.我想知道点到它最优雅的方式是什么.

请参阅我的代码示例(此处,getPlayerHandFromGame方法生成自动释放的字符串,在调用setTitle时保留该字符串):

colourString = [pGame getPlayerHandFromGame:1 withColour:COLOUR_HEARTS];


// Split colourString into array of strings if not null.
    if ([colourString length] != 0) {
        listCards = [colourString componentsSeparatedByString:@" "];
        for (cardCounterSameColour = 1; cardCounterSameColour <= [listCards count]; cardCounterSameColour ++) {
            currentCardButton = [self buttonCardNumber:cardCounter];
            // Objects are numbered from 0 in the array
            [currentCardButton setTitle:[listCards objectAtIndex:cardCounterSameColour-1] forState:UIControlStateNormal];
            cardCounter ++;
        }
    }
Run Code Online (Sandbox Code Playgroud)

由于按钮标题将多次更新,因此将多次调用此部分代码.我想在设置标题之前,我应该这样做:

[currentCardButton titleForState:UIControlStateNormal release]
Run Code Online (Sandbox Code Playgroud)

为了释放将不再使用的字符串(titleForState返回指向NSString的指针).

这是避免设备内存加载未使用的字符串的正确方法吗?

非常感谢,Apple92

iphone objective-c uibutton retain

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

Objective-C setter/getter命名约定让我发疯?

我一直试图了解几个小时的事情,我想得到你的观点.

我在我的一个类属性上有setter/getter(我注意到我必须在setter名称前添加"set",否则编译器会说没有setter):

@property (nonatomic, retain, readwrite, setter=setTopString:, getter=TopString) NSString* m_topString;
Run Code Online (Sandbox Code Playgroud)

当我像这样调用setter时,编译器很高兴:

[secureKeyboardController setTopString:@"This action requires that your enter your authentication code."];
Run Code Online (Sandbox Code Playgroud)

但是当我尝试使用"点"约定时,我被编译器拒绝了:

                secureKeyboardController.topString = @"This action requires that your enter your authentication code.";
Run Code Online (Sandbox Code Playgroud)

真正奇怪的是点命名约定适用于此属性:

@property (nonatomic, readwrite, getter=PINMaxLength, setter=setPINMaxLength:) NSInteger m_PINMaxLength;
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我可以做:

[secureKeyboardController setPINMaxLength:10];enter code here
Run Code Online (Sandbox Code Playgroud)

要么

secureKeyboardController.PINMaxLength = 10;
Run Code Online (Sandbox Code Playgroud)

在这两种情况下,编译器都很高兴.

我真的想睡得比我现在感觉的那么愚蠢.因此,我们将非常感谢任何解释.

此致,Apple92

getter setter objective-c

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