使用泰米尔文本时 UItableview 滚动问题

发布于 2024-11-03 09:12:22 字数 1352 浏览 1 评论 0原文

当我尝试在 UITableview 中显示泰米尔字符时,我无法平滑滚动 tableview 但如果我用英语字符替换泰米尔字符,则滚动不会出现问题。

有什么解决方案吗?

提前致谢!

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier         = @"Cell";
UITableViewCell *cell                   = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil) 
{
    cell                            =   [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    cell.selectionStyle             =   UITableViewCellSelectionStyleNone;  
    cell.backgroundColor=[UIColor   yellowColor];

    UILabel *lblTitle = [[UILabel alloc]init];
    [lblTitle setTag:100];
    [lblTitle setBackgroundColor:[UIColor clearColor]];
    [lblTitle setFont:[UIFont fontWithName:@"Helvetica" size:13]];
    [lblTitle setFont:[UIFont boldSystemFontOfSize:14]];
    [lblTitle setTextColor:[UIColor blackColor]];
    [cell.contentView addSubview:lblTitle];
    [lblTitle release];

}

UILabel     *plblTitle      = (UILabel*)    [cell.contentView viewWithTag:100];

News  *pNewsObj = [appDelegate.CurrentNewsArray objectAtIndex:indexPath.row];

plblTitle.text = pNewsObj.pHeadLine;


return cell;        

}

When I trying to display tamil characters in my UITableview I can't able to smoothly scroll the tableview but if I replace tamil characters with english characters there is no problem in scrolling.

Any solutions ?

Thanks in advance !!!

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier         = @"Cell";
UITableViewCell *cell                   = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil) 
{
    cell                            =   [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    cell.selectionStyle             =   UITableViewCellSelectionStyleNone;  
    cell.backgroundColor=[UIColor   yellowColor];

    UILabel *lblTitle = [[UILabel alloc]init];
    [lblTitle setTag:100];
    [lblTitle setBackgroundColor:[UIColor clearColor]];
    [lblTitle setFont:[UIFont fontWithName:@"Helvetica" size:13]];
    [lblTitle setFont:[UIFont boldSystemFontOfSize:14]];
    [lblTitle setTextColor:[UIColor blackColor]];
    [cell.contentView addSubview:lblTitle];
    [lblTitle release];

}

UILabel     *plblTitle      = (UILabel*)    [cell.contentView viewWithTag:100];

News  *pNewsObj = [appDelegate.CurrentNewsArray objectAtIndex:indexPath.row];

plblTitle.text = pNewsObj.pHeadLine;


return cell;        

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

白衬杉格子梦 2024-11-10 09:12:22

您可以使用滚动视图、标签和按钮创建自定义表格视图。

而且它的滚动非常流畅。

对于前。

In myView.h

       IBOutlet UIScrollView    *scrollView;
        UIButton                *cell[2048];
        NSInteger               cellCount;

- (void) createCell;
- (void) removeCell;


In myView.m

- (void) createCell
{
    [self removeCell];

    float x = 10.0;
    float y = 5.0;

    for (int i = 0; i < [Your NSMutableArray count]; i++)
    {
        cell[cellCount] = [UIButton buttonWithType:UIButtonTypeCustom];
        cell[cellCount].frame = CGRectMake(x, y, 176.0, 10.0);
        [cell[cellCount] setTitle:@"Text" forState:UIControlStateNormal];
        [cell[cellCount] setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        cell[cellCount].titleLabel.font = [UIFont fontWithName:@"Arial" size:14.0];
        [cell[cellCount] addTarget:self action:@selector(cellEvent:) forControlEvents:UIControlEventTouchUpInside];
        cell[cellCount].tag = i;

        [scrollView cell[cellCount]];

        cellCount++;
        y = y + 15.0;
    }

    scrollView.contentSize = CGSizeMake(scrollView.frame.size.width, y);
}

- (void) removeCell
{
    for (int i = 0; i < cellCount; i++)
    {
        [cell[i] removeFromSuperview];
    }
    cellCount = 0;
}

You can create custom table view by using scroll view, label and buttons.

And its scroll very smoothly.

For Ex.

In myView.h

       IBOutlet UIScrollView    *scrollView;
        UIButton                *cell[2048];
        NSInteger               cellCount;

- (void) createCell;
- (void) removeCell;


In myView.m

- (void) createCell
{
    [self removeCell];

    float x = 10.0;
    float y = 5.0;

    for (int i = 0; i < [Your NSMutableArray count]; i++)
    {
        cell[cellCount] = [UIButton buttonWithType:UIButtonTypeCustom];
        cell[cellCount].frame = CGRectMake(x, y, 176.0, 10.0);
        [cell[cellCount] setTitle:@"Text" forState:UIControlStateNormal];
        [cell[cellCount] setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
        cell[cellCount].titleLabel.font = [UIFont fontWithName:@"Arial" size:14.0];
        [cell[cellCount] addTarget:self action:@selector(cellEvent:) forControlEvents:UIControlEventTouchUpInside];
        cell[cellCount].tag = i;

        [scrollView cell[cellCount]];

        cellCount++;
        y = y + 15.0;
    }

    scrollView.contentSize = CGSizeMake(scrollView.frame.size.width, y);
}

- (void) removeCell
{
    for (int i = 0; i < cellCount; i++)
    {
        [cell[i] removeFromSuperview];
    }
    cellCount = 0;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文