【发布时间】:2014-06-13 07:54:19
【问题描述】:
我正在使用以下代码创建一个具有清除按钮模式的文本字段。
self.TextField =[[UITextField alloc]initWithFrame:CGRectMake(30, 0, 200, 30)];
self.TextField.tintColor =[UIColor lightGrayColor];
self.TextField.returnKeyType =UIReturnKeyGo;
self.TextField.clearButtonMode =UITextFieldViewModeWhileEditing;
self.TextField.delegate=self;
[self.view addSubview:self.TextField];
- (CGRect)clearButtonRectForBounds:(CGRect)bounds
{
return CGRectMake(bounds.origin.x - 10, bounds.origin.y, bounds.size.width, bounds.size.height+30);
}
我想为清除按钮设置自定义框架,为此我试图调用“clearButtonRectForBounds”。但是“clearButtonRectForBounds”方法没有调用。如何设置清除按钮的框架?
【问题讨论】:
标签: ios iphone uitextfield