我想知道是否有一种方法可以在 UIAlertView 的构造函数中传递与 initWithTitle 中不同的参数。我特别想传递一个 NSArray。是否可以? 这是代码:
@implementation UIAlertTableView
- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
array=[NSArray arrayWithObjects:@"Capitaliz. semplice",@"Capitaliz. composta",@"Pagamenti rateali",@"Bond", nil];
table = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
table.delegate=self;
table.dataSource=self;
[self addSubview:table];
}
return self;
}
谢谢
最佳答案
每当您问自己这样的问题时,请搜索“[UIClassName] 类引用”
UIAlertView类引用:
它的 init 需要一个 NSString,而不是一个字符串数组:
- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...
关于iphone - AlertView 的 init 方法中的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7937044/