hi in my app I want to implement animation like instagram navigationBar animation.. I done all the thing.. I shrink and expand the headerView according to the UITableview contentOffset.. it shrink well with its subview well but while expand the headerView the subview height and the y position changed..
headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ? 64 : 44))];
UIView *view1 = [[UIView alloc]initWithFrame:headerView.bounds];
view1.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
view1.backgroundColor = [UIColor blackColor];
view1.alpha = 0.1;
[headerView addSubview:view1];
headerView.autoresizesSubviews = YES;
//UIImageView..
headerImageView = [[UIImageView alloc] initWithFrame:CGRectMake((320 - 190) / 2 , (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ? 28 : 8), 190, 28)];
headerImageView.image = [UIImage imageNamed:@"logo.png"];
headerImageView.contentMode = UIViewContentModeScaleAspectFit;
headerImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[headerView addSubview:headerImageView];
//Back button
backButton = [UIButton buttonWithType: UIButtonTypeCustom];
backButton.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[backButton setImage: [UIImage imageNamed: @"listLeftMenu.png"] forState: UIControlStateNormal];
[backButton setFrame: CGRectMake(10, (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ? 34 : 14), 18, 16)];
[backButton addTarget:self action:@selector(leftMenuAction) forControlEvents:UIControlEventTouchUpInside];
[headerView addSubview:backButton];
[self.view addSubview:headerView];
Above code is my headerView initialization...
-(void)scrollViewDidScroll:(UIScrollView *)scrollView
{
CGFloat height = (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0") ? 64 : 44) - scrollView.contentOffset.y;
if (height < 0) {
height = 0;
}
[headerView positionAtX:0 andY:0 withHeight:height]; // This is I change the x, y and height of the headerview..
[postTable positionAtY:height];
}
I know miss anything to keep the subview frame while expand... please help me to fix this issue...