源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

IOS初始化控制器的实现方法总结

  • 时间:2022-07-27 00:08 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:IOS初始化控制器的实现方法总结
[b]IOS初始化控制器的实现方法总结[/b] [b]一.ViewControllViewController方法[/b]
#import "AppDelegate.h"
#import "ViewController.h"

@interface AppDelegate ()

@property(nonatomic,strong) ViewController *viewController;

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  //初始化控制器
  self.viewController = [[ViewController alloc]init];
  //初始化window
  self.window =[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
  //设置控制器
  self.window.rootViewController = self.viewController;

  return YES;
}

[b]二 .ViewControllViewController 与 xib方法[/b]
#import "AppDelegate.h"

#import "XibViewControllViewController.h"

@interface AppDelegate ()

@property(nonatomic,strong) ViewController *viewController;
@property(nonatomic,strong) XibViewControllViewController *xibControllViewController;

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

  //初始化控制器
  self.xibControllViewController = [[XibViewControllViewController alloc]initWithNibName:@"XibViewControllViewController" bundle:nil];
  //初始化window
  self.window =[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
  //设置控制器
  self.window.rootViewController = self.xibControllViewController;


  return YES;
}

如有疑问请留言或者到本站社区交流讨论,感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部