---
title: "在UIAlertVIew 中 添加 UITextField"
author: "helmsman_xcode"
date: "2011-08-15T17:23:18Z"
tags: []
categories: ["移动开发"]
slug: "uialertview-uitextfield"
draft: false
lastmod: "2011-08-15T17:23:18Z"
id: 1149750
url: "https://helmsman-xcode.iteye.com/blog/1149750"
---

```
  UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"添加" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles: @"取消",nil];
    textField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)];
    textField.backgroundColor = [UIColor whiteColor];
    [alert addSubview:textField];
    CGAffineTransform transfrom = CGAffineTransformMakeTranslation(0, 30);  //实现对控件位置的控制
    [alert setTransform:transfrom];
    [alert show];
    [alert release];
```