iPhone - 按钮创建动作视图,如何推送类属性?
Posted
技术标签:
【中文标题】iPhone - 按钮创建动作视图,如何推送类属性?【英文标题】:iPhone - Button creates Action View, how to push class properties? 【发布时间】: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'”
有什么建议吗?
【问题讨论】:
【参考方案1】:在您的 Conference
类中,没有实现 address
方法。
这可能只是实现中的拼写错误。但是,如果您在 Conference 课程中发布代码会更有帮助。
【讨论】:
糟糕!我意识到我试图调用一些不存在的东西 ;)以上是关于iPhone - 按钮创建动作视图,如何推送类属性?的主要内容,如果未能解决你的问题,请参考以下文章