相关疑难解决方法(0)

UIActionSheet addButtonWithTitle:不按正确的顺序添加按钮

我已经子类化了UIActionSheet,在-init方法中,我必须在调用super之后单独添加按钮init(不能传递var_args).

现在,它看起来像这样:

if (self = [super initWithTitle:title delegate:self cancelButtonTitle:cancel destructiveButtonTile:destroy otherButtonTitles:firstButton,nil]) {
  if (firstButton) {
    id buttonTitle;
    va_list argList;
    va_start(argList, firstButtton);
    while (buttonTitle = va_arg(argList, id)) {
      [self addButtonWithTitle:buttonTitle]
    }
    va_end(argList);
  }
}
return self;
Run Code Online (Sandbox Code Playgroud)

但是,我在这种情况下的具体用途没有破坏性按钮,取消按钮和其他四个按钮.当它出现时,订单全部关闭,显示为

Button1
取消
Button2
Button3

就像他们被简单地添加到列表的末尾,这是有道理的; 但是,我不希望它看起来像这样; 那我该怎么办?事实上,是否有任何方法可以UIActionSheet正确地进行子类化并使其工作?

iphone cocoa-touch

9
推荐指数
2
解决办法
7085
查看次数

标签 统计

cocoa-touch ×1

iphone ×1