0
我創建了一個生成例如文本字段的生成器。無法在UIview上顯示UITextview
-(UITextField *)generateTextField
{
UITextField *textfield = [[UITextField alloc]initWithFrame:CGRectMake(100, 150, 100, 40)];
textfield.layer.borderColor = [[UIColor colorWithRed:171.0/255.0 green:171.0/255.0 blue:171.0/255.0 alpha:1.0] CGColor];
return textfield;
}
現在,我在用UIView調用另一個類的這個函數。但它不顯示我在屏幕上的文本框:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
SubtaskGenerator *scg = [[SubtaskGenerator alloc]init];
UITextField * textfield = [scg generateTextField];
[self.view addSubview:textfield];
}
我是否必須以另一種方式進行操作?