CCUIViewWrapper忽略UITextView的位置
问题描述:
我在使用CCUIViewWrapper时无法定位UITextView。无论我如何设置位置,总是会在屏幕的左上角结束。CCUIViewWrapper忽略UITextView的位置
我都试图设置在的UITextView(initWithFrame的初始化位置:CGRectMake(500,500,200,200),并通过改变所述包装本身的位置
的大小设置为包装似乎在任何时候(即我初始化UITextView的大小被忽略)的兑现
在正确的方向任何帮助将是巨大的
我的代码如下所示:!
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(500, 500, 200, 200)];
textView.backgroundColor = [UIColor lightGrayColor];
textView.textColor = [UIColor whiteColor];
textView.text = text;
[textView setEditable:NO];
CCUIViewWrapper* wrapper = [CCUIViewWrapper wrapperForUIView:textView];
wrapper setPosition: CGPointMake(200, 200)];
wrapper.contentSize = CGSizeMake(50, 50);
[self addChild:wrapper];
这导致了大小50×50的一个TextView和位于左上角...
CCUIViewWrapper在GitHub上: https://github.com/splhack/CCUIViewWrapper
答
尝试:
UITextView *textView = [[UITextView alloc] init];
textView.backgroundColor = [UIColor lightGrayColor];
textView.textColor = [UIColor whiteColor];
textView.text = text;
[textView setEditable:NO];
CCUIViewWrapper* wrapper = [CCUIViewWrapper wrapperForUIView:textView];
wrapper.contentSize = CGSizeMake(50, 50);
wrapper.position = ccp(200,200);
[self addChild:wrapper];
还检查了[这提问](http://*.com/questions/3857925/anchorpoint-issues-with-ccuiviewwrapper/8003011#8003011)。这是关于改变锚点,可能有助于解决一些定位问题。 – Shikima 2011-11-04 15:02:55