Ios 阻止视图转换为布局子视图

Ios 阻止视图转换为布局子视图,ios,interface-builder,autolayout,Ios,Interface Builder,Autolayout,我在.xib文件中设计了一个UIViewController。它使用自动布局 我有一个UISlider,当UILabel的值改变时,它会改变UILabel的文本:我已经将发送的事件“值改变”链接到我的头文件,然后在控制器的.m文件中实现该函数。此方法仅更改标签的文本,具体取决于滑块的值 2013-07-16 16:39:47.420 MyApp[2363:907] Stack trace : ( 0 MyApp 0x0003

我在.xib文件中设计了一个UIViewController。它使用自动布局

我有一个UISlider,当UILabel的值改变时,它会改变UILabel的文本:我已经将发送的事件“值改变”链接到我的头文件,然后在控制器的.m文件中实现该函数。此方法仅更改标签的文本,具体取决于滑块的值

2013-07-16 16:39:47.420 MyApp[2363:907] Stack trace : (
    0   MyApp                               0x0003cd5f -[GraphiqueFVViewController viewDidLayoutSubviews] + 50
    1   UIKit                               0x34f938c9 <redacted> + 456
    2   QuartzCore                          0x34d3dd8b <redacted> + 214
    3   QuartzCore                          0x34d3d929 <redacted> + 460
    4   QuartzCore                          0x34d3e85d <redacted> + 16
    5   QuartzCore                          0x34d3e243 <redacted> + 238
    6   QuartzCore                          0x34d3e051 <redacted> + 316
    7   QuartzCore                          0x34d3deb1 <redacted> + 60
    8   CoreFoundation                      0x3315d6cd <redacted> + 20
    9   CoreFoundation                      0x3315b9c1 <redacted> + 276
    10  CoreFoundation                      0x3315bd17 <redacted> + 742
    11  CoreFoundation                      0x330ceebd CFRunLoopRunSpecific + 356
    12  CoreFoundation                      0x330ced49 CFRunLoopRunInMode + 104

    13  GraphicsServices                    0x36c922eb GSEventRunModal + 74
    14  UIKit                               0x34fe4301 UIApplicationMain + 1120
    15  MyApp                               0x00021add main + 116
    16  libdyld.dylib                       0x3b264b20 <redacted> + 0
当视图出现时,滑块不显示(设置在屏幕外部)。我使用动画在视图上显示它。 问题是,当我更改滑块的值时,它会自动调用

 -(void)viewDidLayoutSubviews
{
}
不幸的是,它将控制器视图的所有子视图重置为其原始位置

如何呈现滑块以“破坏”实际布局

编辑

界面生成器中滑块的连接:

以及相关功能的代码:

- (IBAction)sliderDureeValueChanged:(id)sender {
    dureeMois = (int) sliderDuree.value;
    if (sliderDuree.maximumValue == sliderDuree.value)
    {
        [lblDuree setText:@"Max"];
    }
    else if (sliderDuree.minimumValue == sliderDuree.value)
    {
        [lblDuree setText:@"Min"];
    }
    else
    {
        [lblDuree setText:[NSString stringWithFormat:@"%d month",dureeMois]
    }
}
EDIT2

以下是使用滑块调用时,使用
viewdilayoutsubviews
中的
[NSThread callStackSymbols]
获得的堆栈

2013-07-16 16:39:47.420 MyApp[2363:907] Stack trace : (
    0   MyApp                               0x0003cd5f -[GraphiqueFVViewController viewDidLayoutSubviews] + 50
    1   UIKit                               0x34f938c9 <redacted> + 456
    2   QuartzCore                          0x34d3dd8b <redacted> + 214
    3   QuartzCore                          0x34d3d929 <redacted> + 460
    4   QuartzCore                          0x34d3e85d <redacted> + 16
    5   QuartzCore                          0x34d3e243 <redacted> + 238
    6   QuartzCore                          0x34d3e051 <redacted> + 316
    7   QuartzCore                          0x34d3deb1 <redacted> + 60
    8   CoreFoundation                      0x3315d6cd <redacted> + 20
    9   CoreFoundation                      0x3315b9c1 <redacted> + 276
    10  CoreFoundation                      0x3315bd17 <redacted> + 742
    11  CoreFoundation                      0x330ceebd CFRunLoopRunSpecific + 356
    12  CoreFoundation                      0x330ced49 CFRunLoopRunInMode + 104

    13  GraphicsServices                    0x36c922eb GSEventRunModal + 74
    14  UIKit                               0x34fe4301 UIApplicationMain + 1120
    15  MyApp                               0x00021add main + 116
    16  libdyld.dylib                       0x3b264b20 <redacted> + 0
2013-07-16 16:39:47.420 MyApp[2363:907]堆栈跟踪:(
0 MyApp 0x0003cd5f-[GraphiqueFVViewController viewDidLayoutSubviews]+50
1 UIKit 0x34f938c9+456
2夸脱芯0x34d3dd8b+214
3夸脱芯0x34d3d929+460
4夸脱芯0x34d3e85d+16
5夸脱芯0x34d3e243+238
6夸脱芯0x34d3e051+316
7夸脱芯0x34d3deb1+60
8芯基础0x3315d6cd+20
9芯基础0x3315b9c1+276
10芯基础0x3315bd17+742
11 CoreFoundation 0x330ceebd CFRunLoopRunSpecific+356
12 CoreFoundation 0x330ced49 CFRunLoopRunInMode+104
13图形服务0x36c922eb GSEventRunModal+74
14 UIKit 0x34fe4301 UIApplicationMain+1120
15 MyApp 0x00021添加主管道+116
16 libdyld.dylib 0x3b264b20+0
以及在调试区域中的所有回溯:

* thread #1: tid = 0x2503, 0x00101d46 MyApp`-[GraphiqueFVViewController viewDidLayoutSubviews](self=0x1ed972f0, _cmd=0x3541247c) + 42 at GraphiqueFVViewController.m:386, stop reason = breakpoint 2.1
    frame #0: 0x00101d46 MyApp`-[GraphiqueFVViewController viewDidLayoutSubviews](self=0x1ed972f0, _cmd=0x3541247c) + 42 at GraphiqueFVViewController.m:386
    frame #1: 0x34f938c8 UIKit`-[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 456
    frame #2: 0x34d3dd8a QuartzCore`-[CALayer layoutSublayers] + 214
    frame #3: 0x34d3d928 QuartzCore`CA::Layer::layout_if_needed(CA::Transaction*) + 460
    frame #4: 0x34d3e85c QuartzCore`CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 16
    frame #5: 0x34d3e242 QuartzCore`CA::Context::commit_transaction(CA::Transaction*) + 238
    frame #6: 0x34d3e050 QuartzCore`CA::Transaction::commit() + 316
    frame #7: 0x34d3deb0 QuartzCore`CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 60
    frame #8: 0x3315d6cc CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 20
    frame #9: 0x3315b9c0 CoreFoundation`__CFRunLoopDoObservers + 276
    frame #10: 0x3315bd16 CoreFoundation`__CFRunLoopRun + 742
    frame #11: 0x330ceebc CoreFoundation`CFRunLoopRunSpecific + 356
    frame #12: 0x330ced48 CoreFoundation`CFRunLoopRunInMode + 104
    frame #13: 0x36c922ea GraphicsServices`GSEventRunModal + 74
    frame #14: 0x34fe4300 UIKit`UIApplicationMain + 1120
    frame #15: 0x000e6a84 MyApp`main(argc=1, argv=0x2fd1bd18) + 116 at main.m:16
    frame #16: 0x3b264b20 libdyld.dylib`start + 4

  thread #3: tid = 0x2903, 0x3b31b648 libsystem_kernel.dylib`kevent64 + 24
    frame #0: 0x3b31b648 libsystem_kernel.dylib`kevent64 + 24
    frame #1: 0x3b2544f0 libdispatch.dylib`_dispatch_mgr_invoke + 796
    frame #2: 0x3b246df8 libdispatch.dylib`_dispatch_mgr_thread$VARIANT$up + 36

  thread #5: tid = 0x2b03, 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
    frame #0: 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
    frame #1: 0x3b31b04c libsystem_kernel.dylib`mach_msg + 40
    frame #2: 0x3315d044 CoreFoundation`__CFRunLoopServiceMachPort + 128
    frame #3: 0x3315bda2 CoreFoundation`__CFRunLoopRun + 882
    frame #4: 0x330ceebc CoreFoundation`CFRunLoopRunSpecific + 356
    frame #5: 0x330ced48 CoreFoundation`CFRunLoopRunInMode + 104
    frame #6: 0x390cd504 WebCore`RunWebThread(void*) + 444
    frame #7: 0x3b284310 libsystem_c.dylib`_pthread_start + 308

  thread #7: tid = 0x241f, 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
    frame #0: 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
    frame #1: 0x3b31b04c libsystem_kernel.dylib`mach_msg + 40
    frame #2: 0x3315d044 CoreFoundation`__CFRunLoopServiceMachPort + 128
    frame #3: 0x3315bda2 CoreFoundation`__CFRunLoopRun + 882
    frame #4: 0x330ceebc CoreFoundation`CFRunLoopRunSpecific + 356
    frame #5: 0x330ced48 CoreFoundation`CFRunLoopRunInMode + 104
    frame #6: 0x33a1b3d4 Foundation`+[NSURLConnection(Loader) _resourceLoadLoop:] + 308
    frame #7: 0x33a9ee84 Foundation`__NSThread__main__ + 972
    frame #8: 0x3b284310 libsystem_c.dylib`_pthread_start + 308

  thread #8: tid = 0x2d03, 0x3b32b594 libsystem_kernel.dylib`select$DARWIN_EXTSN + 20
    frame #0: 0x3b32b594 libsystem_kernel.dylib`select$DARWIN_EXTSN + 20
    frame #1: 0x331611f6 CoreFoundation`__CFSocketManager + 678
    frame #2: 0x3b284310 libsystem_c.dylib`_pthread_start + 308

  thread #11: tid = 0x3003, 0x3b32b08c libsystem_kernel.dylib`__psynch_cvwait + 24
    frame #0: 0x3b32b08c libsystem_kernel.dylib`__psynch_cvwait + 24
    frame #1: 0x3b27cd2e libsystem_c.dylib`_pthread_cond_wait + 646
    frame #2: 0x3b27caa4 libsystem_c.dylib`pthread_cond_timedwait + 44
    frame #3: 0x37088c74 JavaScriptCore`WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 108
    frame #4: 0x3719a556 JavaScriptCore`JSC::BlockAllocator::blockFreeingThreadMain() + 82
    frame #5: 0x371acfaa JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 14
    frame #6: 0x3b284310 libsystem_c.dylib`_pthread_start + 308

  thread #12: tid = 0x3103, 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
    frame #0: 0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap + 20
    frame #1: 0x3b31b04c libsystem_kernel.dylib`mach_msg + 40
    frame #2: 0x3315d044 CoreFoundation`__CFRunLoopServiceMachPort + 128
    frame #3: 0x3315bda2 CoreFoundation`__CFRunLoopRun + 882
    frame #4: 0x330ceebc CoreFoundation`CFRunLoopRunSpecific + 356
    frame #5: 0x330ced48 CoreFoundation`CFRunLoopRunInMode + 104
    frame #6: 0x39167d06 WebCore`WebCore::runLoaderThread(void*) + 142
    frame #7: 0x371acfaa JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 14
    frame #8: 0x3b284310 libsystem_c.dylib`_pthread_start + 308

  thread #15: tid = 0x3403, 0x3b32b08c libsystem_kernel.dylib`__psynch_cvwait + 24
    frame #0: 0x3b32b08c libsystem_kernel.dylib`__psynch_cvwait + 24
    frame #1: 0x3b27cd2e libsystem_c.dylib`_pthread_cond_wait + 646
    frame #2: 0x3b286f18 libsystem_c.dylib`pthread_cond_wait + 40
    frame #3: 0x37088c46 JavaScriptCore`WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 62
    frame #4: 0x392e1e8c WebCore`WTF::PassOwnPtr<WebCore::StorageTask> WTF::MessageQueue<WebCore::StorageTask>::waitForMessageFilteredWithTimeout<bool (WebCore::StorageTask*)>(WTF::MessageQueueWaitResult&, bool (&)(WebCore::StorageTask*), double) + 56
    frame #5: 0x392e1e40 WebCore`WebCore::StorageThread::threadEntryPoint() + 124
    frame #6: 0x371acfaa JavaScriptCore`WTF::wtfThreadEntryPoint(void*) + 14
    frame #7: 0x3b284310 libsystem_c.dylib`_pthread_start + 308

  thread #17: tid = 0x3903, 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #0: 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #1: 0x3b279cfa libsystem_c.dylib`_pthread_workq_return + 18
    frame #2: 0x3b279a16 libsystem_c.dylib`_pthread_wqthread + 366

  thread #18: tid = 0x3b03, 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #0: 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #1: 0x3b279cfa libsystem_c.dylib`_pthread_workq_return + 18
    frame #2: 0x3b279a16 libsystem_c.dylib`_pthread_wqthread + 366

  thread #19: tid = 0x3707, 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #0: 0x3b32bd98 libsystem_kernel.dylib`__workq_kernreturn + 8
    frame #1: 0x3b279cfa libsystem_c.dylib`_pthread_workq_return + 18
    frame #2: 0x3b279a16 libsystem_c.dylib`_pthread_wqthread + 366
*线程#1:tid=0x2503,0x00101d46 MyApp`-[GraphiqueFVViewController viewDidLayoutSubviews](self=0x1ed972f0,_cmd=0x3541247c)+42位于GraphiqueFVViewController.m:386,停止原因=断点2.1
框架#0:0x00101d46 MyApp`-[GraphiqueFVViewController viewDidLayoutSubviews](self=0x1ed972f0,_cmd=0x3541247c)+42位于GraphiqueFVViewController处。m:386
帧#1:0x34f938c8 UIKit`-[UIView(CALayerDelegate)布局层的子层:+456
帧#2:0x34d3dd8a四芯`-[CALayer layoutSublayers]+214
帧#3:0x34d3d928 QuartzCore`CA::Layer::layout_如果需要(CA::Transaction*)+460
帧#4:0x34d3e85c QuartzCore`CA::Layer::layout_和_display_(如果需要)(CA::Transaction*)+16
帧#5:0x34d3e242 QuartzCore`CA::Context::commit#U事务(CA::transaction*)+238
帧#6:0x34d3e050 QuartzCore`CA::Transaction::commit()+316
帧#7:0x34d3deb0 QuartzCore`CA::Transaction::observer_回调(uu CFRunLoopObserver*,无符号长,void*)+60
帧#8:0x3315d6cc CoreFoundation`\uuuu CFRUNLOOP\u正在调用\u OUT\u到\u观察者\u回调函数\uuu+20
帧#9:0x3315b9c0 CoreFoundation`u cfrunloopdoobserver+276
帧#10:0x3315bd16 CoreFoundation`u CFRunLoopRun+742
帧#11:0x330ceebc CoreFoundation`CFRunLoopRunSpecific+356
帧#12:0x330ced48 CoreFoundation`CFRunLoopRunInMode+104
帧#13:0x36c922ea GraphicsServices`GSEventRunModal+74
帧#14:0x34fe4300 UIKit`UIApplicationMain+1120
帧#15:0x000e6a84 MyApp`main(argc=1,argv=0x2fd1bd18)+116位于main处。m:16
帧#16:0x3b264b20 libdyld.dylib`start+4
线程#3:tid=0x2903,0x3b31b648 libsystem_kernel.dylib`kevent64+24
帧#0:0x3b31b648 libsystem_kernel.dylib`kevent64+24
帧#1:0x3b2544f0 libdispatch.dylib`\u dispatch\u mgr\u invoke+796
帧#2:0x3b246df8 libdispatch.dylib`_dispatch_mgr_thread$VARIANT$up+36
线程#5:tid=0x2b03,0x3b31aeb4 libsystem_内核。dylib`mach_msg_trap+20
帧#0:0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap+20
帧#1:0x3b31b04c libsystem_kernel.dylib`mach_msg+40
帧#2:0x3315d044 CoreFoundation`\uU CFRunLoopServiceMachPort+128
帧#3:0x3315bda2 CoreFoundation`u CFRunLoopRun+882
帧#4:0x330ceebc CoreFoundation`CFRunLoopRunSpecific+356
帧#5:0x330ced48 CoreFoundation`CFRunLoopRunInMode+104
帧#6:0x390cd504 WebCore`RunWebThread(void*)+444
帧#7:0x3b284310 libsystem_c.dylib`\u pthread_start+308
线程#7:tid=0x241f,0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap+20
帧#0:0x3b31aeb4 libsystem_kernel.dylib`mach_msg_trap+20
帧#1:0x3b31b04c libsystem_kernel.dylib`mach_msg+40
帧#2:0x3315d044 CoreFoundation`\uU CFRunLoopServiceMachPort+128
帧#3:0x3315bda2 CoreFoundation`u CFRunLoopRun+882
帧#4:0x330ceebc CoreFoundation`CFRunLoopRunSpecific+356
帧#5:0x330ced48 CoreFoundation`CFRunLoopRunInMode+104
帧#6:0x33a1b3d4基础`+[NSURLConnection(Loader)\U resourceLoadLoop:+308
帧#7:0x33a9ee84基础`\uu NSThread\uuuu main\uuuu+972
帧#8:0x3b284310 libsystem_c.dylib`\u pthread_start+308
线程#8:tid=0x2d03,0x3b32b594 libsystem_kernel.dylib`select$DARWIN_EXTSN+20
帧0:0x3b32b594 libsystem_kernel.dylib`选择$DARWIN_EXTSN+20
帧#1:0x331611f6 CoreFoundation`\uu CFSocketManager+678
帧#2:0x3b284310 libsystem_c.dylib`\u pthread_start+308
线程#11:tid=0x3003,0x3b32b08c libsystem_kernel.dylib`u psynch_cvwait+24
帧#0:0x3b32b08c libsystem_kernel.dylib`_psynch