Hi,
I am having a scrollview, to its layer i am adding a CAScrollLayer as subview, to the CAScrollLayer i am adding layers of 5 imageviews. We do this in viewDidLoad of the viewController whose subview is the scrollview.
Now i add a button's layer as sublayer to one of the sublayers of the CAScrollLayer, this is executed after making an explicit call to the viewDidLoad which executes the first paragraph.
if i dont call the viewDidLoad the button gets displayed, otherwise it does not. Can any one help me out with this issue. The code flow is below.
- (void)viewDidLoad {
bodyLayer = [[CAScrollLayer alloc] init];
bodyLayer.frame = frame;
for(int i=0; i<5; i++)
{
UIImageView *background ;
//Create background image
[bodyLayer addSublayer:background.layer];
}
[coverFlowScrollView.layer addSublayer:bodyLayer];
}
- (void) otherFunc{
[viewController viewDidLoad];
CALayer *layer = (CALayer *)[subLayers objectAtIndex: value? inboxIndex: 2];
NSLog(@"inboxLayer %@", inboxLayer);
[button setFrame:buttonframe];
[layer addSublayer:button.layer];
}