setValuesForKeysWithDictionary的参数版本

时间:2013-04-26 16:28:54

标签: objective-c kvc

在Objective-C中有一种简单的方法可以将方法中的所有参数设置为类的属性吗?类似于setValuesForKeysWithDictionary,但更多的是“setValuesForKeysWithArguments”?

假例子:

@interface SomeClass : NSObject

@property (weak, nonatomic) NSString *foo;
@property (weak, nonatomic) NSString *bar;

- (id)initWithFoo:(NSString *)foo Bar:(NSString *)bar;

@end

@implementation SomeClass
- (id)initWithFoo:(NSString *)foo Bar:(NSString *)bar{
    // Mythical implementation begins here
    [self setValuesForKeysWithArguments:theArgumentsWeJustPassedToThisMethod];
}
@end

0 个答案:

没有答案