0

为什么我的 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);
    }
}
4

1 回答 1

0

isEqualToString您应该使用if 条件中的方法比较字符串:

if ([[titlearray objectAtIndex:i] isEqualToString:selectedCountry])
                                  ^^^^^^^^^^^^^^^
于 2012-08-31T09:17:52.977 回答