IOS Multiple Unknown parameters

Source: Internet
Author: User

-(void) Setgradientcolor: (Uicolor *) Begincolor Transitioncolor: (Uicolor *) Transitioncolor,... Ns_requires_nil_termination;


Ns_requires_nil_termination, for compile-time non- NIL End Checks

-(void) Setgradientcolor: (Uicolor *) Begincolor Transitioncolor: (Uicolor *) Transitioncolor, ... {

[Self.gradientcolors AddObject: (ID) begincolor.cgcolor];

// Define a pointer to an optional parameter list

Va_list args;

// Gets the address of the first optional parameter, at which point the argument list pointer points to the first optional parameter in the function argument list

Va_start (args, transitioncolor);

if (Transitioncolor)

{

[Self.gradientcolors AddObject: (ID) transitioncolor.cgcolor];

// iterate through the parameters in the parameter list and point the argument list pointer to the next parameter in the argument list

Uicolor *nextarg;

while ((Nextarg = Va_arg (args, Uicolor *)))

{

[Self.gradientcolors AddObject: (ID) nextarg.cgcolor];

}

}

// end get of variable parameter ( empty parameter list )

Va_end (args);

}


[Drawcircleview setgradientcolor:[uicolor Purplecolor] transitioncolor:[uicolor redcolor],[uicolor BlueColor], nil];

IOS Multiple Unknown parameters

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.