将视图添加到 UIScrollView 末尾时出现问题
我有一个包含一堆视图的 UIScrollView:
for(NSDictionary* deal in deals)
{
[items addObject:deal];
DealViewController *dvc = [[DealViewController alloc] initWithNibName:@"DealViewController" bundle:nil];
[dvc setNavigationController:[self navigationController]];
UIView *dealView = [dvc view];
[dealViewControllers addObject:dvc];
//setup scrollView
frame.origin.x = frame.size.width * i;
NSLog(@"Frame origin: %f", frame.origin.x);
[dealView setFrame:frame];
[scrollView addSubview:dealView];
i++;
[dvc displayDeal:deal];
}
我想将一个视图添加到滚动视图的最末尾,如下所示:
SignUpViewController* signUpView = [[SignUpViewController alloc] initWithNibName:@"SignUpViewController" bundle:nil];
[scrollView insertSubview:signUpView.view atIndex:[items count]];
signUpView 出现在 UIScrollView 的开头。我怎样才能将它添加到最后?
I have a UIScrollView that contains a bunch of views:
for(NSDictionary* deal in deals)
{
[items addObject:deal];
DealViewController *dvc = [[DealViewController alloc] initWithNibName:@"DealViewController" bundle:nil];
[dvc setNavigationController:[self navigationController]];
UIView *dealView = [dvc view];
[dealViewControllers addObject:dvc];
//setup scrollView
frame.origin.x = frame.size.width * i;
NSLog(@"Frame origin: %f", frame.origin.x);
[dealView setFrame:frame];
[scrollView addSubview:dealView];
i++;
[dvc displayDeal:deal];
}
I want to add a view to the very end of the scrollview as follows:
SignUpViewController* signUpView = [[SignUpViewController alloc] initWithNibName:@"SignUpViewController" bundle:nil];
[scrollView insertSubview:signUpView.view atIndex:[items count]];
The signUpView appears at the beginning of the UIScrollView. How can I add it to the end?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你没有告诉它在哪里画。
You didn't tell it where to draw.
尝试使用
如果您遇到问题请告诉我
Try With
Let me know if you struggle with issue