Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone iOS:具有3个字段的自定义UITableViewCell_Iphone_Ios5 - Fatal编程技术网

Iphone iOS:具有3个字段的自定义UITableViewCell

Iphone iOS:具有3个字段的自定义UITableViewCell,iphone,ios5,Iphone,Ios5,我想创建一个带有3个字段的自定义UITableViewCell。我希望每个字段都可以水平滚动 Field1 Field2 Field3 ====== ====== ====== Label1 | Label2 | [graphics: lines, etc.] 字段1字段2字段3 ====== ====== ====== Label1 | Label2 |[图形:线条等] 我的问题是:实现这一点的正确方式是什么 是否创建具有3个UITableView的自定

我想创建一个带有3个字段的自定义UITableViewCell。我希望每个字段都可以水平滚动

Field1 Field2 Field3 ====== ====== ====== Label1 | Label2 | [graphics: lines, etc.] 字段1字段2字段3 ====== ====== ====== Label1 | Label2 |[图形:线条等] 我的问题是:实现这一点的正确方式是什么

  • 是否创建具有3个UITableView的自定义UIViewController
  • 我是否使用包含以下内容的UITableViewCells创建单个UITableView 3 UITableViewCell子视图
  • 其他的
  • 任何例子都很好


    谢谢大家!

    我将创建一个单独的
    UITableView
    ,其中包含
    uiscrollview
    UIlabel
    UIImageView

    UITableView单元格
    ,您可能需要使用其他选项,使用一个带有单个
    UITableView
    UIViewController


    一个自定义的带有三个UIScrollView的UITableViewCell将对您有所帮助。

    nilweed先生。在这里,它将帮助您在UITableView单元格中添加三个字段。我不知道如何水平滚动tableview

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
    static NSString *CellIdentifier=@"CellIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];
    
    if (cell == nil) 
    { 
    cell = [[[UITableViewCell alloc]
                                initWithStyle:UITableViewCellStyleDefault 
                                reuseIdentifier: CellIdentifier] autorelease];
    
    NSString *cellIconName = [[self cellIcon] objectAtIndex:[indexPath row]];
    cellImage=[UIImage imageNamed:cellIconName];
    
    cell.imageView.image=cellImage;
    
    UILabel *labelOne = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, 60, 20)];
    labelOne.tag = 100;
    [cell.contentView addSubview:labelOne];
    [labelOne release];
    
    UILabel *labelTwo = [[UILabel alloc]initWithFrame:CGRectMake(80, 10, 60, 20)];
    labelTwo.tag = 101;
    [cell.contentView addSubview:labelTwo];
    [labelTwo release];
    
    UILabel *labelThree = [[UILabel alloc]initWithFrame:CGRectMake(160, 10, 150, 20)];
    labelTwo.tag = 103;
    [cell.contentView addSubview:labelTwo];
    [labelTwo release];
    
    }
    
    UILabel *labelOne = (UILabel *) [cell.contentView viewWithTag:100];
    labelOne.text = @"Label One";
    
    UILabel *labelTwo = (UILabel *) [cell.contentView viewWithTag:101];
    labelTwo.text = @"Label Two";
    
    UILabel * labelThree = (UILabel *) [cell.contentView viewWithTag:101];
    labelThree.text = @"Label Three";
     
    
    return cell;
    }
    
    我希望这会对你有所帮助


    谢谢。

    在其中创建自己的自定义TableViewCell,首先将UiScrollView放入其中。在2个Uilabel和1个UiView中(根据您的问题),通过intefacebuilder关闭uiscrollView的垂直滚动。设置uiscrollView的contentSize属性。确保uiscrollView的contentSize宽度大于单元格宽度