我正在继承 UIAlertView。我想实现一个具有以下签名的 init 方法:
- (id)initWithTitle:(NSString *)title
message:(NSString *)message
identifier:(NSInteger)ident
delegate:(id)delegate
cancelButtonTitle:(NSString *)cancelButtonTitle
otherButtonTitles:(NSString *)otherButtonTitles,...
它只是添加了 param 的默认 UIAlertView 方法identifier
。
- (id)initWithTitle:(NSString *)title
message:(NSString *)message
delegate:(id)delegate
cancelButtonTitle:(NSString *)cancelButtonTitle
otherButtonTitles:(NSString *)otherButtonTitles,...
如果我在编译时不知道我的 init 方法otherButtonTitles
参数是什么,那么现在调用 super 方法的正确语法是什么?
self = [super initWithTitle:title
message:message
delegate:delegate
cancelButtonTitle:cancelButtonTitle
otherButtonTitles:otherButtonTitles, nil];
//I will only get the first param with this syntax