ios uitextfield like notes

前端 未结 1 615
执念已碎
执念已碎 2021-01-01 07:00

I wish that my uitextfield seems like the notes of the iPhone, yellow with the lines.. what\'s the best way to do this? thanks in advance!

相关标签:
1条回答
  • 2021-01-01 07:39

    You mean UItextview right? ... its not a UITextField. However, clear your background on the UITextView.

    self.textView.backgroundColor =  [UIColor clearColor];
    

    Then create ImageView that u put as a subview to your textview.

    backgroundimage = [[UIImageView alloc] initWithFrame: CGRectMake(0, -14,textView.frame.size.width, textView.fram.size.height)];
    

    set a pattern image as backgroundColor. This will be your lines. Just create on or two lines . Then it should repeat itself.

    backgroundimage.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"lines.png"];
    

    then add your subview to the textview.

    [self.textView addSubview:backgroundimage];
    

    Good luck!

    0 讨论(0)
提交回复
热议问题