Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate subview from press button #184

Open
Narcissusz opened this issue Oct 19, 2015 · 0 comments
Open

Animate subview from press button #184

Narcissusz opened this issue Oct 19, 2015 · 0 comments

Comments

@Narcissusz
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant