大佬教程收集整理的这篇文章主要介绍了ios – 只绘制一个uilabel周围的顶部,右侧和底部边界,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
喜欢这个
---------------- | I am a label | | ----------------@H_49_4@myLabel.layer.borderWidth = 1; myLabel.layer.borderColor = [UIColor blackColor];
那么反正我只能加3边,甚至1或2边?
谢谢!
// Define the border width in a variable,we'll be using it elsewhere CGFloat borderWidth = 1.0; // This creates a tesTing view to test the theory,in your case this will be your UILabel UIView* view = [[UIView alloc] initWithFrame:CGRectMake(20,60,250,100)]; view.layer.borderColor = [UIColor blackColor].CGColor; view.layer.borderWidth = borderWidth; [self.view addSubview:view]; // Create the mask to cover the area of the view you want to **show** // Here,we create a mask that covers most of the view,except the left edge // The mask needs to be coloured in black,as black acts as transparent,whereas white is opaque in mask parlance UIView* mask = [[UIView alloc] initWithFrame:CGRectMake(borderWidth,view.frame.size.width - borderWidth,view.frame.size.height)]; mask.BACkgroundColor = [UIColor blackColor]; view.layer.mask = mask.layer;
您可以调整面具的大小和位置(给出borderWidth)以显示/隐藏您感兴趣的边框边缘.上面的示例隐藏了左边缘.
以上是大佬教程为你收集整理的ios – 只绘制一个uilabel周围的顶部,右侧和底部边界全部内容,希望文章能够帮你解决ios – 只绘制一个uilabel周围的顶部,右侧和底部边界所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。