Can UITextFields only be added to UIViews?
1a. If they cant, how do you add UITextFields to CCSprites?
1b. If they cant, how do I make my own UIView programmatically not using the Interface Builder? (links welcome)
I have a scene, how d开发者_运维问答o I display a custom UIView from it?
UITextField is UIView subclass and can be added to all UIView classes and subclasses. I don't know what is CCSprites class; if this class have a method like -(void)addView:(UIView*)view;
then you can use this method.
For creating UIView programmaticaly use this code:
UIView *_topHolderView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 100)] autorelease];
_topHolderView.backgroundColor = [UIColor redColor];
[self addSubview:_topHolderView];
//[self.view addSubview:_topHolderView];
精彩评论