如何使用lldb expr在设置运行时设置UIView的框架(DEBUGGING控制台)

时间:2014-12-17 19:52:01

标签: ios xcode console lldb

我正在尝试以下

(lldb) expr [_tvFeed setFrame:(CGRect)CGRectMake(0, 0, 320, 300)];

我正在

error: call to 'CGRectMake' is ambiguous
note: candidate function
note: candidate function
error: 1 errors parsing expression

我正在使用XCode 6.1,LLDB版本lldb-320.4.152

3 个答案:

答案 0 :(得分:5)

好的,这是一种有效的方式

expr CGRect rect; rect.origin.x=0; rect.origin.y=0; rect.size.width=320; rect.size.height=300; (void)[_tvFeed setFrame:rect];

答案 1 :(得分:3)

您可以使用C compound literals创建CGRect,因为它只是一个C结构

看起来像这样

(lldb) expr [_tvFeed setFrame:(CGRect){0, 0, 320, 300}];

答案 2 :(得分:0)

这对我有用:

(lldb) e (void)[(id)0x7fe38ce039c0 setFrame:(CGRect){0,0,200,300}]
(lldb) caflush

0x7fe38ce039c0pviews我要打印的视图的ID。您需要{{3}}才能使pviewscaflush在lldb中工作。

(lldb) pviews
UIWindow: *0x7fe38ce1e330*; frame = (0 0; 414 896); gestureRecognizers = <NSArray: 0x6000006b57a0>; layer = <UIWindowLayer: 0x6000008de480>>
   | <UILayoutContainerView: 0x7fe38ce2ab70; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x6000008c2300>>
   |    | <UITransitionView: 0x7fe38cf079d0; frame = (0 0; 414 896); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x60000086d860>>
   |    |    | <UIViewControllerWrapperView: 0x7fe38cd22f40; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x60000089a640>>
   |    |    |    | <UILayoutContainerView: 0x7fe38f6059c0; frame = (0 0; 414 896); autoresize = W+H; gestureRecognizers = <NSArray: 0x60000068f450>; layer = <CALayer: 0x600000890180>>
   |    |    |    |    | <UINavigationTransitionView: 0x7fe38f608170; frame = (0 0; 414 896); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x600000890700>>
   |    |    |    |    |    | <UIViewControllerWrapperView: 0x7fe38cf13280; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x6000008de9a0>>
   |    |    |    |    |    |    | <UIView: 0x7fe38f304940; frame = (0 0; 414 896); autoresize = W+H; layer = <CALayer: 0x6000008c6800>>
   |    |    |    |    | <UINavigationBar: 0x7fe38f605bc0;