RubyMotion Cookbook笔记-第二章第一节显示弹出对话框
实验目的
制作一个弹出警告对话框,可输入账号与密码
代码部分
class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) #初始化一个UIAlertView实例 alert = UIAlertView.alloc.initWithTitle "Hello World", message: "It's a trap!", delegate: self, cancelButtonTitle: "Cancel", otherButtonTitles: "Ok",nil #设置外观样式,这里使用的是登陆名和密码 alert.alertViewStyle = UIAlertViewStyleLoginAndPasswordInput #设置文本输入框的键盘布局 text = alert.textFieldAtIndex 0 text.keyboardType = UIKeyboardTypeNamePhonePad alert.show true end end
扩展部分
关于UIAlertView的初始化参数中最后一项 otherButtonTitles,是一个字符串的序列,必须以一个nil变量结尾。序列中的每个字符串都被初始化为一个对应标题值的按钮。
如下代码则会额外增加一个按钮
alert = UIAlertView.alloc.initWithTitle "Hello World", message: "It's a trap!", delegate: self, cancelButtonTitle: "Cancel", otherButtonTitles: "Ok","Third Button",nil
关于UIAlertViewStyle的枚举值常用的有以下几种:
- UIAlertViewStyleDefault = 0, //缺省样式
- UIAlertViewStyleSecureTextInput, //密文输入框
- UIAlertViewStylePlainTextInput, //明文输入框
- UIAlertViewStyleLoginAndPasswordInput //上方明文下方密文输入框
相关推荐
PySimpleGUI cookbook-zh-CN 中文版 非机器翻译(目录标题未翻译)
coverage-cookbook-complete-verification-academy Candence Academy官方coverage文档
C++.Cookbook.- c++6本C++.Cookbook.- c++6本
NumPy Cookbook 第一版中文版和第二版英文版,都是PDF高清文字版带完整书签;其中NumPy Cookbook 第一版中文版就是 NumPy攻略:Python科学计算与数据分析
原来不知道可以放压缩文件,现在把iOS 6 Programming Cookbook1-18章中文所有内容全压缩到一个rar里面,方便下载的最新版
原来不知道可以放压缩文件,现在把iOS 6 Programming Cookbook1-16章中文所有内容全压缩到一个rar里面,已经是暂时的最新版
Modern-CPP-Programming-Cookbook-Second-Edition-master Packt 出版 仅供学习参考,阅后删除。
PrimeFaces Cookbook 2nd-Packt Publishing 2015
nginx-cookbook-recipes-high-performance
LLVM指南(LLVM Cookbook)-2015年英文原版,0积分—— 学习编译器的书籍。
Windows 7 and Windows Server 2008 R2 Application Quality Cookbook v1-6
LaTeX指南(LaTeX Cookbook)-2015年英文原版,0积分—— Over 90 hands-on recipes for quickly preparing LaTeX documents to solve various challenging tasks
Kali Linux Web Penetration Testing Cookbook 2nd Edition pdf Discover the most common web vulnerabilities and prevent them from becoming a threat to your site's security Key Features Familiarize ...
uvm-cookbook-registers-guide-verification-academy
python-machine-learning-cookbook-preprocessing oreilly 英文 epub格式
Boost C++ Application Development Cookbook - Second Edition
You’ll learn how to: Create applications that will serve real users Use word embeddings to calculate text similarity Build a movie recommender system based on Wikipedia links ...
docker run -tid -p <port>:80 apachecn0/pandas-cookbook-code-notes # 访问 http://localhost:{port} 查看文档 PYPI pip install pandas-cookbook-code-notes pandas-cookbook-code-notes # 访问 ...
Delphi+Cookbook+-+Second+Edition+第二版+2016-06+-+Daniele+Teti.eng.rar
uvm-cookbook-complete-verification-academy