Если я правильно понимаю, это то, что вы хотите:
вы можете это путем создания пользовательского UIViewController, который окружает UINavigationController. Создайте новый класс под названием "CustomViewController", и вставьте следующий код:
интерфейс
#import <UIKit/UIKit.h>
@interface CustomViewController : UIViewController
- (id)initWithViewController:(UIViewController*)viewController bottomView:(UIView*)bottomView;
@end
Реализация:
#import "CustomViewController.h"
@implementation CustomViewController
- (id)initWithViewController:(UIViewController*)viewController bottomView:(UIView*)bottomView
{
self = [super init];
if (self) {
// Set up view size for navigationController; use full bounds minus 60pt at the bottom
CGRect navigationControllerFrame = self.view.bounds;
navigationControllerFrame.size.height -= 60;
viewController.view.frame = navigationControllerFrame;
// Set up view size for bottomView
CGRect bottomViewFrame = CGRectMake(0, self.view.bounds.size.height-60, self.view.bounds.size.width, 60);
bottomView.frame = bottomViewFrame;
// Enable autoresizing for both the navigationController and the bottomView
viewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
bottomView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin;
// Add views as subviews to the current view
[self.view addSubview:viewController.view];
[self.view addSubview:bottomView];
}
return self;
}
@end
Теперь использовать CustomViewController:
UIView *myBottomView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)];
myBottomView.backgroundColor = [UIColor redColor];
CustomViewController *customViewController = [[CustomViewController alloc] initWithViewController:<yourNavigationController> bottomView:myView];
thank y ОУ!!! это именно то, что я хочу –
oh ,,, у меня проблема при его реализации, могу ли я получить реализованный исходный код? который будет настолько велик: D –
@PangHoMing Если вы расскажете мне больше о том, как вы настраиваете свой UINavigationController, я могу предоставить дополнительный код/информацию. –