Skip to content

Animate subview from press button #184

@Narcissusz

Description

@Narcissusz

Example error

When i click arrowdown button in view (index 0) call function pressedButton: but self.SWdescriptionView animation in view(index1),view(index2) (not current)

Before click arrowdown
screen shot 2015-10-19 at 11 04 24 am

After click arrowdown
screen shot 2015-10-19 at 11 04 15 am

//configure swipe view
_followView.alignment = SwipeViewAlignmentEdge;
_followView.pagingEnabled = NO;
_followView.itemsPerPage = 1;
_followView.truncateFinalPage = YES;
_followView.defersItemViewLoading = NO;

  • (IBAction)pressedButton:(id)sender
    {
    NSLog(@"%ld",(long)[_followView indexOfItemViewOrSubview:sender]);

    [UIView animateWithDuration:0.5
    delay:0
    options: UIViewAnimationCurveEaseOut
    animations:^{

                     if (self.SWdescriptionView.frame.origin.y == 0) {
                         self.SWdescriptionView.frame = CGRectMake(0, 90, self.SWdescriptionView.frame.size.width, self.SWdescriptionView.frame.size.height);   // Black view
                     }else{
                         self.SWdescriptionView.frame = CGRectMake(0, 0, self.SWdescriptionView.frame.size.width, self.SWdescriptionView.frame.size.height); // Black view
                     }
                 }
                 completion:^(BOOL finished){
                     NSLog(@"Done!");
                 }];
    

    [RFRotate rotate180:self.SWbtArrowUpDown withDuration:0.5];

}

  • (UIView *)swipeView:(SwipeView *)swipeView viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view
    {
    //load new item view instance from nib
    //control events are bound to view controller in nib file
    //note that it is only safe to use the reusingView if we return the same nib for each
    //item view, if different items have different contents, ignore the reusingView value

    view = [[NSBundle mainBundle] loadNibNamed:@"customFollowView" owner:self options:nil][0];
    [view setFrame:CGRectMake(0, 0, 300, 170)];

    [self.contentView setClipsToBounds:YES];

    recommendDataModel *data = _feedRecommend.data[(NSUInteger)index];

    NSString *imgUrl = [NSString stringWithFormat:@"http://cms.tvbento.com/uploads/contents/%@/thumb.jpg",data.content_id];

// NSString *imgUrl = [NSString stringWithFormat:@"http://cms.tvbento.com/uploads/contents/%@/2x_%@",data.content_id,data.content_cover_program];
NSURL *url = [NSURL URLWithString:imgUrl];

[self.SWimgPrograms sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeholder.jpg"] options:SDWebImageRefreshCached];

self.SWCategoryView.backgroundColor = [UIColor colorWithHex:data.category_color_code];

[self.SWlblProgramsName setText:data.content_title];
[self.SWlblCategoryName setText:data.category_name];


[self.SWlblDescription setText:[self stringByStrippingHTML:data.content_description]];

return view;

}

Please advice for fix issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions