Add Subview above mainviews layer
calayer, ios, subview, uiview, xcode
Solution
Thats not possible so far, The best solution i can think of is that add both the subview and its parent view inside another view than its just a matter of reordering two subviews, so that your subview is above the other and its border.
Hope that help!
Problem
I am having trouble adding a subview above the CALayer of its parent view. I tried to attach an image to show what i mean but i dont have enough reputation so here is a link to the image: http://imageshack.us/photo/my-images/843/img0219u.png/ Part of the subview is obscured by the parent views border. How can i make the subview appear over the top of the parent views layer? Any help is appreciated. Here is my code if it helps: Code for adding layer: ``` 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; ``` Code for adding subview: ``` 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]; ```