2
A
回答
7
我发现了一个解决方案: http://www.iphonedevsdk.com/forum/iphone-sdk-development/1704-uitextfield-inside-uialertview.html
这里是为我工作的代码。
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Your title here" message:@"this gets covered" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
[myAlertView setTransform:myTransform];
[myTextField setBackgroundColor:[UIColor whiteColor]];
[myAlertView addSubview:myTextField];
[myAlertView show];
[myAlertView release];
4
您需要创建弹出窗口(UIAlertView)并将UITextField(或任何您想使用的组件)添加到它作为子视图。 UIAlertView不会为您添加的组件自动调整大小,因此您必须通过向其中添加文本来将它的那部分一起破解。该文本将增加弹出窗口的高度,并提供您不会添加太多被您的组件隐藏的内容。
1
将此函数添加到您的代码中,在显示警报之前调用它。
- (无效)willPresentAlertView:(UIAlertView中*)alertView { alertView.frame = CGRectMake(X,Y,宽度,heigth); }
1
一种调整您的UIAlertView中提示...
由于米伦Milkovski上/下,如果你设置了UIAlertView中的委托写道:
UIAlertView* theAlert = [[UIAlertView alloc] initWithTitle:@"Lah"
message:@"dee dah"
delegate:self
cancelButtonTitle:nil
otherButtonTitles:nil];
//NSLog(@"Pre Show: alert frame x,y: %f,%f, alert frame width,height: %f,%f", theAlert.frame.origin.x,theAlert.frame.origin.y, theAlert.frame.size.width, theAlert.frame.size.height);
[retrievingListAlert show];
然后,您可以修改通过定义以下UIAlertView回调(在委托类中 - 在这种情况下,因为我们使用self,与创建UIAlertView的位置相同)的UIAlertView框架:
(void)willPresentAlertView:(UIAlertView *)alertView {
//NSLog(@"willPresentAlertView: alert frame midx,midy: %f,%f, alert frame width,height: %f,%f", alertView.frame.origin.x, alertView.frame.origin.y, alertView.frame.size.width, alertView.frame.size.height);
alertView.frame = CGRectMake(x, y, width, heigth);
}
我发现在其他时间设置帧不起作用。看起来show功能修改框架,大概是在自动调整内容的同时。
相关问题
- 1. 是否有任何全功能的Brainfuck编辑器可用?
- 2. 无编辑弹出VB编辑器
- 3. 弹出编辑模式中的多列
- 4. 是否有可能在没有“编辑”菜单项的可可应用程序中具有“编辑”功能?
- 5. 是否支持折叠F#编辑器中的所有功能节点?
- 6. Cocoa弹出式菜单中是否有层次可能?
- 7. RubyMine是否具有TextMate风格的多行编辑功能?
- 8. 如何在代码编辑器中弹出jquery窗体编辑
- 9. 是否有可能编辑Eclipse命令
- 10. Monobehaviour脚本中的编辑器功能
- 11. 从tinymce编辑器中删除功能
- 12. 使用弹出模式编辑
- 13. asp.net gridview编辑模式弹出日历
- 14. 是否有Python内置Python编辑器?
- 15. 是否有eot字体编辑器?
- 16. Dojo是否有Markdown编辑器
- 17. 是否有任何.editorconfig GUI编辑器?
- 18. Designer弹出窗口编辑器问题
- 19. 如何在Sitecore页面编辑器中启用编辑功能?
- 20. 是否有jQuery退出功能?
- 21. iPhone:是否有可能以编程方式制作视频
- 22. 是否有可能以编程方式将iPhone静音?
- 23. MVC C#编辑功能是添加而不是编辑
- 24. 动态创建编辑器 - 浏览器是否需要退出该功能才能进行更改?
- 25. 是否有编辑器或IDE能够返回外部程序输出?
- 26. ReST文件是否有智能编辑器?
- 27. 在GUIDE中编辑一个功能,改变所有功能?
- 28. Visual Studio代码是否具有智能标记编辑功能(如WebStorm)?
- 29. 是否有magit中的功能,emacs git插件,可以跳转到编辑?
- 30. 编辑jquery的弹出框