0
내가 태그를 할당하려고 한 다음 NSMutableArray
있는 NSMutableArray NSLog는 다른 결과
#import "myClass"
static NSString *kC = @"100";
static NSString *kLo = @"110";
@interface MyApp()
@property (strong, nonatomic) NSMutableArray *arrayTag;
@end
@Synthesize arrayTag;
viewDidLoad
arrayTag = [[NSMutableArray alloc] init];
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
cell.showsReorderControl = YES;
}
if (indexPath.row == 0)
{
cell.tag = kC;
NSString *cTag = [NSString stringWithFormat:@"%i", cell.tag];
if (![arrayTag containsObject:cTag])
{
[arrayTag addObject:cTag];
}
}
if (indexPath.row == 1)
{
cell.tag = kLo;
NSString *loTag = [NSString stringWithFormat:@"%i", cell.tag];
if (![arrayTag containsObject:loTag])
{
[arrayTag addObject:loTag];
}
}
return cell;
}
NSLog
에 만드는거야 출력
2013-07-10 15:46:39.468 MyApp[1013:c07] Number of Objects in Array 2
2013-07-10 15:46:39.469 MyApp[1013:c07] Object at Index 0 in Array 1624272
2013-07-10 15:46:39.469 MyApp[1013:c07] Object at Index 1 in Array 1624256
2013-07-10 15:46:39.469 MyApp[1013:c07] From ArrayTag obj: 1624272
2013-07-10 15:46:39.470 MyApp[1013:c07] From ArrayTag obj: 1624256
Q : Object[0] = 100
및 Object[1] = 110
의 값이 cell.tag
과 일치하지 않아야합니까? 왜 1624272와 1624256이 표시됩니까?
나는 내가하고 있던 바보 같은 것을 알고 있었다! 감사. – user1107173