1

テーブル セル内にテーブルを作成して、App Store のような水平方向のテーブル セル スライドを同様に表示しようとしました。

アプリ ストアに移動し、注目の製品タブをクリックすると、意味が表示されます。

入れ子になった横型スライドテーブル。

インターネットから非常にうまく機能するものをダウンロードしましたが、ペン先を使用しているようです。ストーリーボード機能を使って作成したいと考えています。これについての私の理由は、特にセグエなどを行うときに使いやすいと思うからです。

私はここまで完成しましたが、適切に収まるようにセルのサイズを変更できないようです(つまり、セルの幅は回転したテーブルの高さです)

これは、ダウンロードしたソースからコピーした私のコードの一部です

テーブル

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   static NSString *CellIdentifier = @"Cell";
   TableViewCell *cell = (TableViewCell*)[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];

   if (cell == nil) {

       CGAffineTransform rotateTable = CGAffineTransformMakeRotation(-M_PI_2);
       tableViewCell.horizontalTableView.transform = rotateTable;
       tableViewCell.horizontalTableView.frame = CGRectMake(0, 0, tableViewCell.horizontalTableView.frame.size.width, tableViewCell.horizontalTableView.frame.size.height);

      tableViewCell.contentArray = [arrays objectAtIndex:indexPath.section];

      tableViewCell.horizontalTableView.allowsSelection = YES;
      //cell = tableViewCell.horizontalTableView;

     }

    return cell;
} 

表のセル

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   static NSString *CellIdentifier = @"Cell";
   UITableViewCell *cell = [self.horizontalTableView dequeueReusableCellWithIdentifier:CellIdentifier];
   if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] ;
   }

   for (UIImageView *view in cell.subviews) {
       [view removeFromSuperview];
   }

   CGAffineTransform rotateTable = CGAffineTransformMakeRotation(-M_PI_2);
   horizontalTableView.transform = rotateTable;
   horizontalTableView.frame = CGRectMake(0, 0, horizontalTableView.frame.size.width, horizontalTableView.frame.size.height);

   tableViewCell.contentArray = [arrays objectAtIndex:indexPath.section];

   horizontalTableView.allowsSelection = YES;

   UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
   imageView.image = [contentArray objectAtIndex:indexPath.row]];
   imageView.contentMode = UIViewContentModeCenter;

   CGAffineTransform rotateImage = CGAffineTransformMakeRotation(M_PI_2);
   imageView.transform = rotateImage;

   [cell addSubview:imageView];

   return cell;
}

発生した問題を説明させてください: - cell==nil は機能しません。- cell = tableViewCell.horizo​​ntalTableView はコメントアウトされています。これは、UITableView dataSource must return cell from tableView:cellForRowAtIndexPath エラーが常に発生するためです - セルの回転は、テーブル セル セクションにあるように機能しているようですが、これが問題の場所のようですサイズを変更できません

誰かが私のコードを手伝ってくれたり、ストーリーボードがネストされた水平テーブルが機能しているサイトを教えてくれたりしたら、大歓迎です。

(私はまだアプリ開発のプロと呼ばれていませんが、これを実現しようとして境界を広げていることに注意してください)

4

0 に答える 0