私は Storyboard を使用しており、既存の UIView (UILabels のようなすべての「子」を含む) をプログラム的に ScrollView に複製して追加したいと考えています。最初に、そのビュー(EventView)のカスタム UIView-Class を作成し、タグで識別して UILabels の新しいテキストを初期化します。今、私はこれらの EventViews を次のように Scrollview に追加したいと思います:
CGRect rect = CGRectMake(0.0, 0.0, 320, 320*10);
UIView *theView = [[UIView alloc] initWithFrame:rect];
for (int i = 0; i<10; i++)
{
CGRect rC = CGRectMake(0.0, 320*i, 320, 320);
EventView *dV = [[EventView alloc] initWithFrame:rC];
[dV inWithEvent:allEvents[i]];//Strings for the UILabels
[theView addSubview:dV];
}
theScrollView.contentSize = rect.size;
[theScrollView addSubview:theView];
}
より良い(そして機能する)解決策はありますか?ありがとう!