【发布时间】:2015-08-27 00:38:05
【问题描述】:
请让我知道如何在我的UIViewController 中使用此自定义UITextField
我正在使用故事板。
#import <UIKit/UIKit.h>
@interface MYTextField : UITextField
@end
@implementation MYTextField
- (CGRect)textRectForBounds:(CGRect)bounds {
int margin = 10;
CGRect inset = CGRectMake(bounds.origin.x + margin, bounds.origin.y, bounds.size.width - margin, bounds.size.height);
return inset;
}
- (CGRect)editingRectForBounds:(CGRect)bounds {
int margin = 10;
CGRect inset = CGRectMake(bounds.origin.x + margin, bounds.origin.y, bounds.size.width - margin, bounds.size.height);
return inset;
}
【问题讨论】:
-
这应该不难回答,但我不明白你到底想做什么?你在使用故事板吗?在发布代码之前编辑您的问题并留出 4 个空格,使其更具可读性。
-
是的,我正在使用故事板,我想在我的文本字段中应用左边距,我遵循此代码但我无法实现此。stackoverflow.com/questions/5674655/…
标签: ios objective-c ios7