我试图附加图像来显示我的意思,但我没有足够的声誉,所以这里是图像的链接:
http://imageshack.us/photo/my-images/843/img0219u.png/
子视图的一部分被父视图边框遮挡.
如何使子视图显示在父视图层的顶部?
任何帮助表示赞赏.
如果有帮助,这是我的代码:
添加图层的代码:
UIVIEw *student = [[UIVIEw alloc] initWithFrame:CGRectMake(50,50,100,100)]; student.backgroundcolor = [UIcolor graycolor]; CALayer *studentLayer = [[CALayer alloc] init]; studentLayer.bordercolor = [UIcolor graycolor].CGcolor; studentLayer.borderWIDth = 5; student.layer.bordercolor = studentLayer.bordercolor; student.layer.borderWIDth = studentLayer.borderWIDth;
添加子视图的代码:
UILabel *ilp = [[UILabel alloc] initWithFrame:(CGRectMake(-20,-10,40,20))]; ilp.text = @"ILP"; ilp.backgroundcolor = [UIcolor yellowcolor]; ilp.textcolor = [UIcolor blackcolor]; ilp.textAlignment = NSTextAlignmentCenter; [student addSubvIEw:ilp];解决方法 到目前为止,这是不可能的,我能想到的最好的解决方案是将子视图及其父视图添加到另一个视图中,而不仅仅是重新排序两个子视图,以便您的子视图位于另一个及其边界之上.
希望有所帮助!
总结以上是内存溢出为你收集整理的ios – 在主视图层上方添加子视图全部内容,希望文章能够帮你解决ios – 在主视图层上方添加子视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)