iOS 局部变量 setTag后可在别的地方调用 viewWithTag
//比如在某个方法里设置后 UITextField* testFild=[[UITextField alloc] initWithFrame:CGRectMake(0, 48, 200, 200)]; testFild.text = @"qingjoin"; testFild.tag = bbbb; [self.view addSubview:testFild]; //在另一个方法里面也可以得到这个值 UITextField *t = (UITextField*)[self.view viewWithTag:bbbb]; NSLog(@"ttfftf:%@",t.text);