简体   繁体   English

水平的tableview单元滚动iOS

[英]Horizantal tableview cell scrolling iOS

I had an issue in one of the app with horizantal table view scrolling.I created tableview with custom tableviewcell, in the custom tableviewcell I created one more tableview with the tableviewcells and tableview header.I transformed the tableview and tableview cells but after rotation the I am unable to change the frame of table view.Here is the code what I used so far... 我在一个应用程序中遇到了一个问题,即要使用水平表格视图滚动。我使用自定义tableviewcell创建了表格视图,在自定义tableviewcell中又创建了一个带有tableviewcells和tableview header的表格视图。我转换了tableview和tableview单元格,但是旋转无法更改表格视图的框架。这是我到目前为止使用的代码...

- (void)viewDidLoad {
[super viewDidLoad];

//self.ibTableView.estimatedRowHeight = 568.0f;
self.ibTableView.transform=CGAffineTransformMakeRotation(-M_PI/2);
self.ibTableView.backgroundColor=[UIColor clearColor];
self.ibTableView.pagingEnabled=YES;
self.ibTableView.showsVerticalScrollIndicator=NO;

// Do any additional setup after loading the view.}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
SPCustomTableVIewCellTableViewCell *cell = (SPCustomTableVIewCellTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"cell"];

if (cell == nil) {
    cell = (SPCustomTableVIewCellTableViewCell *)[SPCustomTableVIewCellTableViewCell loadFromNib];
}

[tableView dequeueReusableCellWithIdentifier:@"cell"];
cell.transform=CGAffineTransformMakeRotation(M_PI/2);
cell.backgroundColor = [UIColor clearColor];
return cell;}

SPCustomTableVIewCell.m SPCustomTableVIewCell.m

- (void)awakeFromNib {

self.headerView = [HeaderTableView loadFromNib];
self.internalTableView.tableHeaderView = self.headerView;
// Initialization code}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

InternalCustomTableViewCell *cell = (InternalCustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:@"cell"];

if (cell == nil) {
    cell = (InternalCustomTableViewCell *)[InternalCustomTableViewCell loadFromNib];
    [tableView dequeueReusableCellWithIdentifier:@"cell"];
}
cell.backgroundColor = [UIColor clearColor];
return cell; }

Please any help to resolve the issue to set the frame after transformation of table view 请提供任何帮助以解决问题,以在转换表格视图后设置框架

If you want to apply animations to a UITableViewCell, you should use 如果要将动画应用于UITableViewCell,则应使用

- (void) tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath

I think it is a bad solution to do this in cellForRowAtIndexPath . 我认为在cellForRowAtIndexPath执行此操作是一个不好的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM