【问题标题】:iPhone - Button creates Action View, how to push class properties?iPhone - 按钮创建动作视图,如何推送类属性?
【发布时间】:2011-03-28 20:42:07
【问题描述】:

大家好,刚刚有一个关于 UIAlertViews 的问题。 我在单元格中有一个按钮,我希望将对象的数据推送到 UIAlertView 正文部分。现在我有这个:

- (void)locationButton:(id)selector{
    NSString *addressBody = [NSString stringWithFormat:@"%@", [[testList     objectAtIndex:selectedCellIndexPath.row] address]];
    UIAlertView *addressView = [[UIAlertView alloc] initWithTitle:nil
                                                message:addressBody
                                               delegate:self
                                      cancelButtonTitle:@"OK"
                                      otherButtonTitles:@"Show on Map", nil];
    [addressView show];
    [addressView release];
}

在 viewDidLoad 中,我像这样初始化了 Conference 类

testList = [[NSMutableArray alloc] init];
Conference *conf1 = [[Conference alloc] initWithConferenceId:110];
Conference *conf2 = [[Conference alloc] initWithConferenceId:130];
[testList addObject:conf1];
[testList addObject:conf2];

但是当按下按钮时,警报视图不会显示,最终会崩溃

“由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'-[会议地址]:无法识别的选择器发送到实例0x5e273a0'”

有什么建议吗?

【问题讨论】:

    标签: uitableview ios4 uibutton parameter-passing uialertview


    【解决方案1】:

    在您的 Conference 类中,没有实现 address 方法。

    这可能只是实现中的拼写错误。但是,如果您在 Conference 课程中发布代码会更有帮助。

    【讨论】:

    • 糟糕!我意识到我试图调用一些不存在的东西 ;)
    猜你喜欢
    • 2013-06-08
    • 1970-01-01
    • 2011-10-22
    • 2017-05-23
    • 2012-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多