-4

次のコードを試しましたが、最初のコードしかotherButtonTitles表示されません。

- (id)initWithCancelButtonTitle:(NSString *)cancelButtonTitle primaryButtonTitle:(NSString *)primaryButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...
{
    self = [self init];
    if (self)
    {
        // Build normal buttons
        va_list argumentList;
        va_start(argumentList, otherButtonTitles);

        NSString *argString = otherButtonTitles;

        while (argString != nil)
        {
            UIButton *button = [self buildButtonWithTitle:argString];

            [self.buttons addObject:button];

            argString = va_arg(argumentList, NSString *);
        }

        va_end(argumentList);

        // Build cancel button
        UIButton *cancelButton = [self buildCancelButtonWithTitle:cancelButtonTitle];
        [self.buttons insertObject:cancelButton atIndex:0];

        // Add primary button
        if (primaryButtonTitle)
        {
            UIButton *primaryButton = [self buildPrimaryButtonWithTitle:primaryButtonTitle];
            [self.buttons addObject:primaryButton];
        }

        // Add destroy button
        if (destructiveButtonTitle)
        {
            UIButton *destroyButton = [self buildDestroyButtonWithTitle:destructiveButtonTitle];
            [self.buttons insertObject:destroyButton atIndex:1];
        }
    }

    return self;
}

それを変更する方法は?

4

1 に答える 1