Just My Life & My Work

[iOS] TextField Inset

實在不知道怎麼翻TextField Inset,我會把它描述為「留邊」。因為TextField沒有ContentInset這個property,所以要另找技巧來實現。

TextField Inset



 Theme: TextField Inset
 IDE: Xcode 6
 Language: Objective C
 Date: 104/04/21
 Author: HappyMan
 Blog: https://cg2010studio.wordpress.com/
    UIView *left1View = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, oldTextField.frame.size.height)];
    left1View.backgroundColor = oldTextField.backgroundColor;
    oldTextField.leftView = left1View;
    oldTextField.leftViewMode = UITextFieldViewModeAlways;

    UIView *left2View = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, newTextField.frame.size.height)];
    left2View.backgroundColor = newTextField.backgroundColor;
    newTextField.leftView = left2View;
    newTextField.leftViewMode = UITextFieldViewModeAlways;

    UIView *left3View = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, renewTextField.frame.size.height)];
    left3View.backgroundColor = renewTextField.backgroundColor;
    renewTextField.leftView = left3View;
    renewTextField.leftViewMode = UITextFieldViewModeAlways;


參考:Text inset for UITextField?

Comments on: "[iOS] TextField Inset" (2)

  1. 現在要做地球與天堂App,感謝這篇文章!讓我直接取用~ 😀

  2. I was speculating if anyone can easily recommend a pretty good provider of vape company leads (UK Vape Shop Database)? I am trying to choose between Creative Bear Tech, The Eliquid Boutique, and WowItLoveItHaveIt. Has anybody had any experience with these particular companies? Thanks

BilalKag 發表迴響 取消回覆


WordPress.com 標誌

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google photo

您的留言將使用 Google 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )


您的留言將使用 Facebook 帳號。 登出 /  變更 )

連結到 %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


%d 位部落客按了讚: