oc 可变參数传递
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oc 可变參数传递相关的知识,希望对你有一定的参考价值。
- (id)initWithFrame:(CGRect)frame delegate:(id<SGFocusImageFrameDelegate>)delegate focusImageItems:(SGFocusImageItem *)firstItem, ... { self = [super initWithFrame:frame]; if (self) { NSMutableArray *imageItems = [NSMutableArray array]; SGFocusImageItem *eachItem; va_list argumentList; if (firstItem) { [imageItems addObject: firstItem]; va_start(argumentList, firstItem); while((eachItem = va_arg(argumentList, SGFocusImageItem *))) { [imageItems addObject: eachItem]; } va_end(argumentList); } objc_setAssociatedObject(self, (const void *)SG_FOCUS_ITEM_ASS_KEY, imageItems, OBJC_ASSOCIATION_RETAIN_NONATOMIC); _isAutoPlay = YES; [self setupViews]; [self setDelegate:delegate]; } return self; }
以上是关于oc 可变參数传递的主要内容,如果未能解决你的问题,请参考以下文章