我有一个包含大量视图的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];
}
我想在scrollview的最后添加一个视图,如下所示:
SignUpViewController* signUpView = [[SignUpViewController alloc] initWithNibName:@"SignUpViewController" bundle:nil];
[scrollView insertSubview:signUpView.view atIndex:[items count]];
signUpView出现在UIScrollView的开头。如何将其添加到最后?
答案 0 :(得分:1)
frame.origin.x = frame.size.width * i;
[signUpView setFrame:frame];
你没有告诉它在哪里画画。
答案 1 :(得分:0)
尝试使用
[scrollView insertSubview:signUpView.view atIndex:[items count] - 1];
如果您遇到问题
,请告诉我