I'm having trouble positioning a UITextView when using the CCUIViewWrapper. Whatever I set the position to it always ends up in top left corner of the screen.
I've both tried to set the position in initializer of the UITextView (initWithFrame:CGRectM开发者_如何学编程ake(500, 500, 200, 200) and by changing the position of the wrapper itself.
The size set to the wrapper seems to be honored at all times (i.e what I initialize the UITextView size to is ignored).
Any help in the right direction would be great!
my code looks like this:
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];
This results in a textview with a size of 50x50 and positioned in the top left corner...
CCUIViewWrapper on GitHub: https://github.com/splhack/CCUIViewWrapper
try:
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];
精彩评论