iPhone App里弹出输入面板的方法
2010-06-19 18:34:00 来源:WEB开发网在.h里先宣告
UITextField *yourtextfield;
@property (nonatomic, retain, readonly) UITextField yourtextfield;
在.m里
@synthesize yourtextfield;
然后自己加上
- (UITextField *)yourtextfield
{
if (yourtextfield == nil)
{
CGRect frame = CGRectMake(x, y, width, height); //textfield的位置大小
yourtextfield = [[UITextField alloc] initWithFrame:frame];
yourtextfield.enabled = TRUE;
yourtextfield.borderStyle = UITextBorderStyleNone;
yourtextfield.textColor = [UIColor blackColor];
yourtextfield.font = [UIFont systemFontOfSize:14.0];
yourtextfield.placeholder = @"user name";
yourtextfield.backgroundColor = [UIColor whiteColor];
yourtextfield.autocorrectionType = UITextAutocorrectionTypeNo; // no auto correction support
yourtextfield.keyboardType = UIKeyboardTypeDefault; // 一般的键盘style
yourtextfield.returnKeyType = UIReturnKeyDone;
yourtextfield.clearButtonMode = UITextFieldViewModeWhileEditing; //可以一次清除输入中的文字
yourtextfield.tag = kViewTag; // tag this control so we can remove it later for recycled cells
textFieldNormalyourtextfield.delegate = self; // 让user输入完,按下done 键盘会自动收起来
// Add an accessibility label that describes what the text field is for.
[yourtextfield setAccessibilityLabel:NSLocalizedString(@"username", @"")];
}
return yourtextfield;
}
最后要在dealloc 中release
[yourtextfield release];
- ››iphone图片拉伸的几种方法
- ››iphone正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››iPhone新手机 不挂YouTube APP
- ››iPhone 获取指定格式的时间和日期
- ››iPhone版PPS走进生活 观赏体验媲美PC版
- ››APP Loading页设计和App从当前页进入新页面交互
更多精彩
赞助商链接