我将这些数组设置为进入 a NSDictionary
,然后将它们添加到NSMutableArray
. 这是设置部分。
注意:数组的内容有点随机,因为我只是在尝试一些东西。
现在我期待的是“太棒了!”这个词。只会重复 3 x 3 次,因为 和 的计数NSMutableArray
都headArray
只有 3。
那么为什么当我使用操作符符号时它会重复 4 x 3 次<=
呢?这不应该做 3 次,因为它匹配的计数只有 3 次?
现在我很欣赏节数设置为 0,这可能是一个解释,但它需要为 0 才能位于 UITableView 的顶部。
listOfItems = [[NSMutableArray alloc] init];
headerArray = [[NSArray alloc] initWithObjects:@"Country 1", @"Country 2", @"Country 3", nil];
NSArray *countriesToLiveInArray = [NSArray arrayWithObjects:@"Iceland", @"Greenland", @"Switzerland", @"Norway", @"New Zealand", @"Greece", @"Italy", @"Ireland", nil];
NSDictionary *countriesToLiveInDict = [NSDictionary dictionaryWithObject:countriesToLiveInArray forKey:@"Countries"];
NSArray *countriesLivedInArray = [NSArray arrayWithObjects:@"India", @"U.S.A", nil];
NSDictionary *countriesLivedInDict = [NSDictionary dictionaryWithObject:countriesLivedInArray forKey:@"Countries"];
NSArray *thirdArray = [NSArray arrayWithObjects:@"Row 01", @"Row 02", @"Row 03", @"Row 04", nil];
NSDictionary *thirdDictionary = [NSDictionary dictionaryWithObject:thirdArray forKey:@"Countries"];
if (headerArray.count == listOfItems.count)
{
for (section = 0; section <= listOfItems.count; section++)
{
NSLog(@"AWESOME!!");
}
}
2013-02-17 20:10:06.323 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.324 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.325 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.326 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.327 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.328 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.330 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.331 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.332 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.332 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.334 TableView[3667:11303] AWESOME!!
2013-02-17 20:10:06.335 TableView[3667:11303] AWESOME!!