TableView 드롭다운 보기 확대 및 이미지 전시
다음은 애니메이션 효과입니다.
애니메이션.gif
말을 많이 하지 않고 바로 코드에 올리다
뷰 생성
    //UITableView   ImageView
    self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, V_Width, V_height/3)];
    self.imageView.image = [UIImage imageNamed:@"3"];
    //  imageView     
    self.imageView.contentMode = UIViewContentModeScaleAspectFill;
    self.imageView.userInteractionEnabled = YES;
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(createAllImageView)];
    [self.imageView addGestureRecognizer:tap];
    
    //UITableView
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, V_Width, V_height) style:UITableViewStylePlain];
    //  tableView    
    self.tableView.contentInset = UIEdgeInsetsMake(V_height/3, 0, 0, 0);
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    
    [self.view addSubview:self.tableView];
    [self.view addSubview:self.imageView];
  TableView 드래그 시 이벤트
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    
    CGPoint point = scrollView.contentOffset;
    //      
    if (point.y < -V_height/3 && point.y >= -V_height/3-60) {
        CGRect rect = self.imageView.frame;
        rect.origin.y = 0;
        rect.size.height = -point.y;
        self.imageView.frame = rect;
    }
    //        
    if (point.y > -V_height/3) {
        CGRect rect = self.imageView.frame;
        rect.origin.y = -point.y - V_height/3;
        self.imageView.frame = rect;
    }
    //       ,    View
    if (point.y <= -V_height/3-60) {
        [self createAllImageView];
    }
}
  새 뷰 작성
/**
 *   Window     View
 */
- (void)createAllImageView{
    //V_Width        
    //V_height        
    
    //        _allView,     
    if (_allView) {
        return;
    }
    
    //Window  View
    _allView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, V_Width, V_height/3)];
    _allView.backgroundColor = [UIColor blackColor];
    
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(removeAllImageView:)];
    [_allView addGestureRecognizer:tap];
    
    //     ImageView
    _likeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, V_Width, V_height/3)];
    _likeImageView.image = [UIImage imageNamed:@"3"];
    [_allView addSubview:_likeImageView];
    
    // Window     
    [[UIApplication sharedApplication].keyWindow addSubview:_allView];
    
    CGRect rect1 = _allView.frame;
    rect1.size.height = V_height;
    
    CGRect rect2 = _likeImageView.frame;
    rect2.origin.y = (V_height - V_height/3)/2;
    
    //    
    [UIView animateWithDuration:0.8 animations:^{
        _allView.frame = rect1;
        _likeImageView.frame = rect2;
    }];
}
  Window에서 보기 제거
/**
 *    Window  View
 *
*/
- (void)removeAllImageView:(UITapGestureRecognizer *)tap{
    
    CGRect rect1 = _allView.frame;
    rect1.size.height = V_height/3;
    
    CGRect rect2 = _likeImageView.frame;
    rect2.origin.y = 0;
    
    //    
    [UIView animateWithDuration:0.5 animations:^{
        _allView.frame = rect1;
        _likeImageView.frame = rect2;
        _allView.alpha = 0;
    } completion:^(BOOL finished) {
        [_likeImageView removeFromSuperview];
        [_allView removeFromSuperview];
        _allView = nil;
    }];
}
  tableView의 일부 에이전트 이벤트는 여기에 상세하게 쓰여 있지 않습니다. 여러분의 지적을 환영합니다
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.