我正在尝试将UISegmentedControl
放在Navigation Item
上,但它使我的xcode崩溃。
。H
IBOutlet UISegmentedControl *segmentedControl;
.m
self.navigationItem.titleView=segmentedControl;
这只是使我的xcode崩溃并显示错误
2013-03-12 17:38:56.343 Magazine[4728:1dc03] *** Assertion failure in -[UINavigationBar layoutSublayersOfLayer:], /SourceCache/UIKit_Sim/UIKit-2372/UIView.m:5776
2013-03-12 17:38:56.344 Magazine[4728:1dc03] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Auto Layout still required after executing -layoutSubviews. UINavigationBar's implementation of -layoutSubviews needs to call super.'
*** First throw call stack:
(0x2854012 0x1ee9e7e 0x2853e78 0x197ff35 0xe819ef 0x1efd6b0 0x7d1fc0 0x7c633c 0x7c6150 0x7440bc 0x745227 0x7458e2 0x281cafe 0x281ca3d 0x27fa7c2 0x27f9f44 0x27f9e1b 0x2d1c7e3 0x2d1c668 0xe3165c 0x2de5 0x2ce5)
libc ++ abi.dylib:终止调用引发异常
为什么会出现此错误
最佳答案
UISegmentedControl * seg1 = [[UISegmentedControl alloc]
initWithItems:[NSArray arrayWithObjects:@"von mir", @"alle", nil]];
[seg1 setSegmentedControlStyle:UISegmentedControlStyleBar];
self.navigationItem.titleView = seg1;
关于iphone - UISegmentedControl``导航项目上的Xcode崩溃,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15360934/