Program_the_ape
csdn-Hu
2015-08-18 04:27
采纳率: 90.9%
浏览 1.7k
已采纳

iOS 在AppDelegate.m文件里请求返回的ViewController出现bug

//[self returnViewController];

  • (UIViewController*)returnViewController {

    CGRect calendarFrame = CGRectMake(0, 0, 320, 568);
    calendarFrame.size.height -= 44;

    CalendarViewController *calendar=[[CalendarViewController alloc]init];
    calendar.view.frame=calendarFrame;

    return calendar;

}
//bug
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "CalendarView" nib but the view outlet was not set.'

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

3条回答 默认 最新

  • ruzhuxiaogu
    ruzhuxiaogu 2015-08-27 08:07
    已采纳

    1, 打开xib文件

    2, 点击"File‘s Owner",设置Class为xxxViewControler

    3, 右键"Files‘s Owner", 里面有个默认的IBOutlet变量view, 看一下后面有没有做关联,如果没有就拉到下面的View和视图做个关联

    点赞 评论
  • a5978445
    a5978445 2015-08-18 11:54

    xib文件没有设置输出口

    点赞 评论
  • zhao18933
    sun_ljz 2015-08-19 05:58

    检查一下 Xib 中 CalendarViewController 的连线 (IBOutlet),应该有异常的连线,删除掉重新连一次

    点赞 评论

相关推荐