English 中文(简体)
定 义 反对:forKey:meth of NSMutable 理论
原标题:setObject:forKey: method of NSMutableDictionary

第一个参数是否应当成为物体? 下面的1米分辨率第1参数是西贝迪德文本,其定义是:

UITextField *textFieldBeingEdited

案文是不是用什么文字来复制物体,案文是该物体的财产?

以下编码故障:

[tempValues setObject:textFieldBeingEdited forKey:tagAsNum];

如果我改为这样的话,它就会发生故障:

[tempValues setObject:textFieldBeingEdited.text forKey:tagAsNum];

尽管第一种论点被认为是一个目标,而不是一个财产,这并没有意义。

最佳回答

一种财产是合成糖,是一种采集方法,可回收一个物体,也可选择一种带物体的固定方法。 。 NSDictionary 。

基本上,财产提供了两种方法。 例如,通过<代码>text<>/code>实施/编纂的财产可照此办理(为实例简化):

- (NSString *) text
{
    return text;
}

- (void) setText:(NSString *) newText
{
    if (text != newText)
    {
        [text release];
        text = [newText copy];
    }
}

当您使用<代码>object.text = @"Hello"时,实际上将把setText:的电文(@>Hello)作为论据,并在您使用时发出。 缩略语

问题回答





相关问题
How do you create UIBarButtonItems with a radio interface?

I have a UIToolbar that needs three buttons in a radio style, meaning that of the three, only one button can be pushed at a time. The documentation makes reference to the possibility of setting up ...

iPhone settings bundle

I want to allow the user to enter a valid date using the iPhone’s settings application. I have experimented with many of the PreferenceSpecifiers data node types including date. I have two issues: ...

Circular #import/@class problem in ObjectiveC

I m going to use an example to properly illustrate my confusion. I can t quite wrap my head around this. In Cocoa touch, we have UIViewController and its subclass, UINavigationController. Now, UIVC ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Cocoa-Touch: issue looping MPMoviePlayerController

I have an app which has to load some data at startup, so I want to display a splash-screen animation. I m using the MPMoviePlayerController to play a m4v file. The movie has it s background set to [...

Iphone sequential animation with setAnimationDelay

I m trying to chain animation events. The application I m coding for work has a multiple choice quiz. First you pick your multiple choice answer. The quiz view fades away. Then a label ("correct" or "...