开发者

Some questions about UIViews and UITextFields

开发者 https://www.devze.com 2023-02-16 15:24 出处:网络
Can UITextFields only be added to UIViews? 1a. If they cant, how do you add UITextFields to CCSprites?
  1. 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)

  2. 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];
0

精彩评论

暂无评论...
验证码 换一张
取 消