注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

IOS & JAVA KEY

(iMilo)

 
 
 

日志

 
 
关于我

All the splendor in the world is not worth a good friend!! Hello my friend!!

网易考拉推荐

浅析自定义UIAlertView  

2011-06-20 21:32:31|  分类: IOS |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

 

引入

IOS中实现自定义的UIAlertView

方案一、使用UIAlertView未公开APIcode

     UIAlertView  *myAlert = [[UIAlertView alloc] initWithTitle: @"信息提示"

                                                       message: @"自定义警告框:\n"

                                                      delegate: self

                                             cancelButtonTitle: @"Cancel"

                                             otherButtonTitles: @"OK", nil];

    

    [myAlert addTextFieldWithValue: @"" label: @"账号:"];

    UITextField * textField1 = [myAlert textFieldAtIndex: 0];

    textField1.tag = 1;

    textField1.keyboardType = UIKeyboardTypeAlphabet;

    textField1.keyboardAppearance = UIKeyboardAppearanceAlert;

    textField1.autocapitalizationType  = UITextAutocapitalizationTypeWords;

    textField1.autocorrectionType = UITextAutocapitalizationTypeNone;

    textField1.textAlignment = UITextAlignmentLeft;

    

    [myAlert addTextFieldWithValue: @"" label: @"密码:"];

    UITextField * textField2 = [myAlert textFieldAtIndex: 1];

    textField2.tag = 2;

    textField2.keyboardType = UIKeyboardTypeNumbersAndPunctuation;

    textField2.keyboardAppearance = UIKeyboardAppearanceAlert;

    textField2.autocapitalizationType  = UITextAutocapitalizationTypeWords;

    textField2.autocorrectionType = UITextAutocapitalizationTypeNone;

    textField2.textAlignment = UITextAlignmentLeft;

    

    [myAlert show];

    [myAlert release];

    [textField1 release];

    [textField2 release];

方案二、自定义坐标(code

     UIAlertView * myAlert = [[UIAlertView alloc] initWithTitle: @"信息提示:"

                                                       message: @"\n\n\n"

                                                      delegate: self

                                             cancelButtonTitle: @"Cancel"

                                             otherButtonTitles: @"OK", nil];

    

    UITextField * textField1 = [[UITextField alloc] initWithFrame: CGRectMake(12.0f, 60.0f, 260.0f, 25.0f)];

    textField1.keyboardType = UIKeyboardTypeAlphabet;

    textField1.keyboardAppearance = UIKeyboardAppearanceAlert;

    textField1.autocapitalizationType  = UITextAutocapitalizationTypeWords;

    textField1.autocorrectionType = UITextAutocapitalizationTypeNone;

    textField1.placeholder = @"默认值 ";

    textField1.borderStyle = UITextBorderStyleRoundedRect;

    textField1.textAlignment = UITextAlignmentLeft;

    textField1.tag = 2;

    //textField1.delegate = self;

    [myAlert addSubview: textField1];

    

    [myAlert show];

    [myAlert release];

    [textField1 release];

参考

自定义 UIAlertView (custom an UIAlertView instance)

时间

2011-06-20

 

 

 

  评论这张
 
阅读(4534)| 评论(0)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017