首页 文章

uitextview周围的自定义边框

提问于
浏览
0

我正在尝试在包含字符而不是默认边框选项的 UITextview 周围创建自定义边框 . 关于如何实现这一点的任何指针?

以下是我正在尝试做的一个例子 . 我敢肯定,我可以通过将它放在UITextview上来标记,但我想至少询问并查看是否有人知道如何使用自定义边框执行此操作 .

enter image description here

2 回答

  • 1

    希望您需要一个图像(文本边框),满足您对 UItextView 边框的所有需求:

    然后尝试这样的事情:

    [self.txtView.layer setBorderWidth:3.0];
    [self.txtView.layer setBorderColor:[[UIColor colorWithPatternImage:[UIImage imageNamed:@"textedImage.png"]] CGColor]];
    
  • 0

    使用此代码 .

    txtfld.layer.borderColor=[[UIColor blackColor]CGColor];
    
    txtfld.layer.borderWidth=1.0;
    

    并记住你的.h文件中的 import #import <QuartzCore/QuartzCore.h>

    您还可以指定RGB值 .

    txtfld.layer.borderColor=[[UIColor colorWithRed:178.0f/255.0f green:178.0f/255.0f blue:178.0f/255.0f alpha:1.0] CGColor];
    

相关问题