UICollecionView
を含むいくつかのセルがあります。行の高さについては、UITableViewAutomaticDimension
とAutolayout
を使用します。スクロールせずに一度にコレクションビュー全体の内容を表示するようにセルのサイズを自動的に変更することは可能ですか?UICollectionViewを含むUITableViewCellをサイズ変更
このセルに4個のタグ:
EDIT:自動サイズ変更が正常に動作しますが、アライメントが正しくありません。私は純粋なAutolayout
ですべてをやろうとしていますが、サブクラス化することなくUICollectionViewFlowLayout
はありません。最後の行は常に正しいです。私はここで
void ConfigureCollectionCell(ProfileEditCollectionCell cell, String property, IList list, nint tag)
{
cell.propertyName = property;
cell.collectionView.Tag = tag;
cell.collectionView.BackgroundColor = UIColor.White;
cell.collectionView.DataSource = this;
cell.collectionView.RegisterNibForCell(UINib.FromName("ProfileEntityCell", NSBundle.MainBundle), "profileEntityCell");
(cell.collectionView.CollectionViewLayout as UICollectionViewFlowLayout).EstimatedItemSize = new CoreGraphics.CGSize(150, 20);
var collectionHeight = NSLayoutConstraint.Create(cell.collectionView , NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, cell.collectionView.CollectionViewLayout.CollectionViewContentSize.Height);
cell.collectionView.AddConstraint(collectionHeight);
}
public UICollectionViewCell GetCell(UICollectionView collectionView, Foundation.NSIndexPath indexPath)
{
var cell = collectionView.DequeueReusableCell("profileEntityCell", indexPath) as ProfileEntityCell;
cell.BackgroundColor = UIColor.Red;
ConfigureCollectionEntity(cell, indexPath, collectionView.Tag); //not important
collectionView.SetNeedsUpdateConstraints();
collectionView.UpdateConstraints();
return cell as UICollectionViewCell;
}
コレクションビューまたはテーブルビューをスクロールせずに、すべてのコレクションビューセルをテーブルビューセルにしたいスクロールコレクションのビューを右にしたくないですか? –
はい、まったく、この表のセルを展開して全体のコレクションビューを表示したいとします。 – bjp
答えを参照してください助けてください –