UITextField *textField = [[UITextField alloc] init]; textField.frame = CGRectMake(38.0f, 0.0f, self.view.frame.size.width - 38.0f, 40.0f); textField.text = @"Hello"; textField.background = [[UIImage imageNamed: @"field.png"] stretchableImageWithLeftCapWidth:12 topCapHeight:19]; textField.backgroundColor = [UIColor whiteColor]; textField.userInteractionEnabled = YES; [bar addSubview: textField]; bar.userInteractionEnabled = TRUE;