阿拉伯语中的UITableView不起作用

时间:2014-09-18 13:27:44

标签: ios

我在下面的阿拉伯语代码中遇到了标题和cellForRow的问题。

这些代码以英文运作。

任何人都可以看到我做错了什么并解决了问题?

感谢。

不幸的是,由于10个声誉的东西,我无法发布图片。

例如来自UITableView

A

艾卜哈

阿布扎比

C

巴林

贝鲁特

d

- (void)setupIndexData:objects {

    self.collation = [UILocalizedIndexedCollation currentCollation];
    NSInteger index, sectionTitleCount = [[self.collation sectionTitles] count];
    NSMutableArray *newSectionArray = [[NSMutableArray alloc] initWithCapacity:sectionTitleCount];

    for (index = 0; index < sectionTitleCount; index++) {
        [newSectionArray addObject:[NSMutableArray array]];
    }

    for (NSString *airportList in objects) {
        NSInteger sectionNumber = [self.collation sectionForObject:airportList collationStringSelector:@selector(city)];
        [[newSectionArray objectAtIndex:sectionNumber] addObject:airportList];
    }

    for (index = 0; index < sectionTitleCount; index++) {
        NSMutableArray *airportListArrayForSection = [newSectionArray objectAtIndex:index];
        [newSectionArray replaceObjectAtIndex:index withObject:[self.collation sortedArrayFromArray:airportListArrayForSection collationStringSelector:@selector(city)]];
    }

    self.sectionArray = newSectionArray;
    [self.table reloadData];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return [[[self.collation sectionTitles] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    NSMutableArray *airportListsInSection = (self.sectionArray)[section];
    return [airportListsInSection count];
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
   return [[[self.collation sectionTitles] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)] objectAtIndex:section];
}

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
    return [[self.collation sectionIndexTitles] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
}

- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {
    return [self.collation sectionForSectionIndexTitleAtIndex:index];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    ....
    Aiports *airportLists = (self.sectionArray)[indexPath.section][indexPath.row];
    cell.textLabel.text = airportLists.city;
}

0 个答案:

没有答案