如何在Object-C中添加一个具有自己的UIViewController的子视图?
UIViewControllers
UIViewController
toolbar
ViewController
ViewController
addChildViewController
storyboard
addChildViewController
NavigationController
addChildViewController
IDUtilityViewController.h
#import <UIKit/UIKit.h>@interface IDUtilityViewController : UIViewController@property (strong, nonatomic) IBOutlet UIView *utilityView;@end
IDUtilityViewController.m
#import "IDUtilityViewController.h"#import "IDAboutViewController.h"@interface IDUtilityViewController () @property (nonatomic, strong) IDAboutViewController *aboutVC;@end@implementation IDUtilityViewController- (void)viewDidLoad{ [super viewDidLoad]; self.aboutVC = [[IDAboutViewController alloc]initWithNibName:@"AboutVC" bundle:nil]; [self addChildViewController:self.aboutVC]; [self.aboutVC didMoveToParentViewController:self]; [self.utilityView addSubview:self.aboutVC.aboutView];}@end
-EDIT
storyboard
相关分类