为什么我不能lbl_esdeger.text字符串值?谢谢你的帮助
selectedCountry = @“Kanıt”; lblText.text = selectedCountry;
titlearray = [[NSMutableArray alloc]init];
//KANAL D
[titlearray addObject:@"Annem Uyurken"];
[titlearray addObject:@"Arka Sokaklar"];
[titlearray addObject:@"Kanıt"];
[titlearray addObject:@"Kötü Yol"];
int i;
for (i=0; i<[titlearray count]; i++)
{
if ([titlearray objectAtIndex:i] == selectedCountry)
{
lbl_esdeger.text = [titlearray objectAtIndex:i];
NSLog(@"--- %@ --- %@",[titlearray objectAtIndex:i],selectedCountry);
}
}
答案 0 :(得分:0)
您应该使用if条件中的方法isEqualToString
来比较字符串:
if ([[titlearray objectAtIndex:i] isEqualToString:selectedCountry])
^^^^^^^^^^^^^^^