首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为UITextField增加价值

为UITextField增加价值
EN

Stack Overflow用户
提问于 2014-09-11 21:05:56
回答 1查看 7关注 0票数 0

我正在尝试显示一个基于警报窗口中的OK按钮的UITextField。因此,当用户按下OK按钮时,会出现另一个文本框,用户可以在其中输入配置文件名称。然而,根据下面的代码,我看到在点击OK之后,它继续说"No profile name specified“,因为它发现profile.txt是空的。下面是一段代码,它显示弹出警报,提示用户使用配置文件名称保存配置文件。

代码语言:javascript
运行
复制
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Hello, User ! Save Profile" message:@"Provide a profile Name" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK" ,nil];

profileName = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 2600.0, 25.0)];

[profileName setBackgroundColor:[UIColor whiteColor]];

[alert addSubview:profileName];

CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);

[alert setTransform:myTransform];

[alert show];

[alert release];

感谢您的回复!

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2014-09-11 22:04:28

我能够让它在iOS7上工作,

alert.alertViewStyle = UIAlertViewStylePlainTextInput;profileName = alert textFieldAtIndex:0;

谢谢

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25788280

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档