UITextView background image

后端 未结 10 2027
说谎
说谎 2020-12-02 08:44

How can I set up a background image to UITextView?

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 09:11

    Just one clarification, when trying out answer #9 from @oxigen, I found out that this line:

    UIImageView *imgView = [[UIImageView alloc]initWithFrame: textView.frame];
    

    Is relative to the textView.frame. So your x and y values need to be 0,0 if you want it to overlap completely which means you want something like:

    UIImageView *imgView = [[UIImageView alloc]initWithFrame:textView.bounds];
    

提交回复
热议问题