【Objective-C】UITextFieldにインデントを設定する
UITextFieldにてインデントを設定するときのメモです。
// UITextFieldを作成 UITextField* textField = (UITextField *)[hogeView viewWithTag:1234]; textField.background = [UIImage imageNamed:@"hogehoge.png"]; // インデントを作成 UIView* spacerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 10)]; [textField setLeftViewMode:UITextFieldViewModeAlways]; [textField setLeftView:spacerView];
UIViewを作成して、UITextFieldの中に突っ込んでるだけっぽいですね。。
今回もスタックオーバーフローに助けられました。
http://stackoverflow.com/questions/7565645/indent-the-text-in-a-uitextfield
以上です。