Ios 问题文本字段更改为搜索文本
我正在为我的文本创建文本字段 当我创建它时,它会显示一行附加到我的文本字段 我把这张照片附在这张照片上 我的代码是Ios 问题文本字段更改为搜索文本,ios,cocoa-touch,ipad,uitextfield,Ios,Cocoa Touch,Ipad,Uitextfield,我正在为我的文本创建文本字段 当我创建它时,它会显示一行附加到我的文本字段 我把这张照片附在这张照片上 我的代码是 -(void)createTextField{ if (([[UIDevice currentDevice]orientation]==UIDeviceOrientationLandscapeLeft)||([[UIDevice currentDevice]orientation]==UIDeviceOrientationLandscapeRight)) {
-(void)createTextField{
if (([[UIDevice currentDevice]orientation]==UIDeviceOrientationLandscapeLeft)||([[UIDevice currentDevice]orientation]==UIDeviceOrientationLandscapeRight)) {
[text setFrame:CGRectMake(640, 15, 300,40)];
}
else {
[text setFrame:CGRectMake(390,15,300,50)];
}
text.font = [UIFont systemFontOfSize:20];
text.layer.cornerRadius = 20;
text.delegate=self;
[text setTextColor:[UIColor blackColor]];
text.alpha=1.0;
text.autocorrectionType = UITextAutocorrectionTypeNo;
text.returnKeyType=UIReturnKeySearch;
UIImageView *searchLogo = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon-search-black.png"]];
[text setLeftView:searchLogo];
[text setLeftViewMode:UITextFieldViewModeAlways];
[searchLogo release];
text.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
text.borderStyle=UITextBorderStyleRoundedRect;
[text setBackgroundColor:[UIColor whiteColor]];
[text setHidden:NO];
[self addSubview:text];
[text becomeFirstResponder];
}
它必须是
边框样式
踢入,即
text.borderStyle = UITextBorderStyleRoundedRect;
您可以使用
UITextBorderStyleNone
,因为您已经使用cornerRadius
自定义了边框样式,它必须是borderStyle
插入的样式,即
text.borderStyle = UITextBorderStyleRoundedRect;
您可以使用
UITextBorderStyleNone
,因为您已经使用cornerRadius
自定义了边框样式。您还可以为文本框显示html吗?您还可以为文本框显示html吗?