0
我通過在循環的每次迭代中打印cell.textlable.text的值來檢查每次它的值如我所願,但作爲在模擬器上輸出的時間的值對於每行單元來說都是相同的。獲取相同的值在每個單元格中的表視圖在objective-c
my code:
for(i=0;i<[appDelegate.books count];i++)
{
Book *aBook= [appDelegate.books
objectAtIndex:i];
NSString *string1 =aBook.Latitude;
NSString *trimmedString = [string1
stringByTrimmingCharactersInSet:[NSCharacterSet
whitespaceAndNewlineCharacterSet]];
double myDouble = [trimmedString doubleValue];
NSString *string2=aBook.Longitude;
NSString *trimmedString1 = [string2
stringByTrimmingCharactersInSet:[NSCharacterSet
whitespaceAndNewlineCharacterSet]];
double mDouble = [trimmedString1 doubleValue];
if((((myDouble<(a+5.021777))&&(myDouble>(a-
8)))||((mDouble<=(b+10))&&(mDouble>=(b-10)))))
{
NSString *a1=aBook.AreaName;
NSString *b1=[a1 stringByAppendingString:@","];
NSString *s=aBook.STREET_NAME;
NSString *c=[b1 stringByAppendingString:s];
cell.textLabel.text = c ;
}
}
return cell; }