gpt4 book ai didi

iphone - AlertView 的 init 方法中的参数

转载 作者:行者123 更新时间:2023-11-29 04:56:04 24 4
gpt4 key购买 nike

我想知道是否有一种方法可以在 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类引用:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html

它的 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com