我已经在ViewController中的Scrollview内部初始化了五个不同的视图控制器。我已经成功并完成了应用程序的大部分工作,我只是试图找出一些松散的目标。在iPhone5屏幕上,初始化的NavViewControllers(其中包含了表格视图)完全符合屏幕高度......但是当我在iPhone 4s中运行它时,视图没有覆盖的空间。
我认为你可以考虑我设计我的观点的方法是一个皇家混乱。我使用storyboard viewController来保存scrollview(我知道这不是问题,因为当我从viewCont1。滚动到viewCont2时。第一个控制器填满了屏幕)。然后我继承第一个viewcontroller并初始化scrollview中的所有其他视图。我将StoryBoards用于navControllers,将xib用于其他所有内容。这是我的viewDidLoad
方法,如果它可以帮助您更好地理解。
- (void)viewDidLoad
{
[super viewDidLoad];
[self setNeedsStatusBarAppearanceUpdate];
// Do any additional setup after loading the view, typically from a nib.
//initial view
RadioViewController *radioViewController = [[RadioViewController alloc]init];
[self addChildViewController:radioViewController];
[self.scrollView addSubview:radioViewController.view];
[radioViewController didMoveToParentViewController:self];
//second view
UIStoryboard *likeStoryboard = [UIStoryboard storyboardWithName:@"LikesDislikes" bundle:nil];
LikeViewController *likeViewController = [likeStoryboard instantiateViewControllerWithIdentifier:@"LikeStart"];
CGRect likeframe = likeViewController.view.frame;
likeframe.origin.x = 320;
likeViewController.view.frame = likeframe;
[self addChildViewController:likeViewController];
[self.scrollView addSubview:likeViewController.view];
[likeViewController didMoveToParentViewController:self];
//third view
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"SermonNav" bundle:nil];
SermonViewController *sermonViewController = [storyboard instantiateViewControllerWithIdentifier:@"SermonStart"];
CGRect serframe = sermonViewController.view.frame;
serframe.origin.x = 640;
sermonViewController.view.frame = serframe;
[self addChildViewController:sermonViewController];
[self.scrollView addSubview:sermonViewController.view];
[sermonViewController didMoveToParentViewController:self];
//fourth view
ScheduleViewController *scheduleViewController = [[ScheduleViewController alloc]init];
CGRect schedframes = scheduleViewController.view.frame;
schedframes.origin.x = 960;
scheduleViewController.view.frame = schedframes;
[self addChildViewController:scheduleViewController];
[self.scrollView addSubview:scheduleViewController.view];
[scheduleViewController didMoveToParentViewController:self];
//fifth view
FinalViewController *finalViewController = [[FinalViewController alloc]init];
CGRect finframes = finalViewController.view.frame;
finframes.origin.x = 1280;
finalViewController.view.frame = finframes;
[self addChildViewController:finalViewController];
[self.scrollView addSubview:finalViewController.view];
[finalViewController didMoveToParentViewController:self];
self.scrollView.contentSize = CGSizeMake(1600, self.view.frame.size.height);
self.scrollView.pagingEnabled = YES;
}
我想我需要一个正确方向的指针,指出可能导致这种情况的原因。模拟器下面有照片(4英寸视网膜,3.5英寸视网膜)。我倾向于它是navViewControllers故障。我只是坚持要检查或尝试下一步我做了我能做的所有事情。