我有基于页面的应用程序。在每个页面上,我在顶部有 3 个 uibuttons,在右侧有字母表(用于在 uitable 中排序数据的 uibuttons)的 uiscrollview,在中心有 uitableview。如何显示单元格的详细视图?如果有必要添加 uinavigationcontroller 我不能这样做。如果我添加它,它会禁用与我的表格、按钮和滚动视图的交互。另一个问题是当进入下一页时如何在 tableview 和 scrollview 中显示新数据?
我有 rootViewController 类和 DataViewController 类。rootViewController 清单:
@interface RootViewController ()
@property (readonly, strong, nonatomic) ModelController *modelController;
@end
@implementation RootViewController
@synthesize pageViewController = _pageViewController;
@synthesize modelController = _modelController;
@synthesize navContr = _navContr;
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
// Configure the page view controller and add it as a child view controller.
//[self presentModalViewController:navContr animated:YES];
self.pageViewController = [[[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil] autorelease];
self.pageViewController.delegate = self;
DataViewController *startingViewController = [self.modelController viewControllerAtIndex:0 storyboard:self.storyboard];
NSArray *viewControllers = [NSArray arrayWithObject:startingViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];
self.pageViewController.dataSource = self.modelController;
[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];
self.navContr = [[UINavigationController alloc] initWithRootViewController:self.pageViewController];
[self.view addSubview:self.navContr.view];
// Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
CGRect pageViewRect = self.view.bounds;
self.pageViewController.view.frame = pageViewRect;
[self.pageViewController didMoveToParentViewController:self];
// Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
for (UIGestureRecognizer *recognizer in self.pageViewController.gestureRecognizers){
if ([recognizer isKindOfClass:[UITapGestureRecognizer class]]){
[recognizer setEnabled:NO];
}
}
}
经过几次操作后,它可以工作,但我需要帮助才能让它正常工作!
所以现在看起来像这样
下一个问题:如何去除顶部的棕色空间???
::更新::
问题解决了。只需将 UINavigationController 的 y 轴位置设置为 -20 ;)