gpt4 book ai didi

objective-c - 我正在尝试使用 if 条件,但我无法让它工作 xcode

转载 作者:行者123 更新时间:2023-11-28 18:44:36 25 4
gpt4 key购买 nike

我正在尝试使用一个简单的 if 条件来等同于注释的标题,但它不起作用任何人都可以告诉我我在这里做错了什么,

if([annotation title] == @"Parking")
{
pin.pinColor = MKPinAnnotationColorPurple;
}

当我打印标题时它显示正常

NSLog(@" these are the titles %@",[annotation title]);

但是当我尝试使用 if 条件匹配它时它不起作用

任何帮助将不胜感激

提前感谢您的任何建议或帮助

最佳答案

使用 isEqualToString:@"Parking"

所以替换为:

if([[annotation title] isEqualToString:@"Parking"])
{
pin.pinColor = MKPinAnnotationColorPurple;
}

关于objective-c - 我正在尝试使用 if 条件,但我无法让它工作 xcode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6376832/

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