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

rotation multiple sections #14

Closed
BrandonCopley opened this issue Mar 2, 2012 · 2 comments
Closed

rotation multiple sections #14

BrandonCopley opened this issue Mar 2, 2012 · 2 comments

Comments

@BrandonCopley
Copy link
Contributor

update the section code to this:

I had issues forking and trying to sync. Github kept timing out.

-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if ([delegate respondsToSelector:@selector(easyTableView:viewForHeaderInSection:)]) {

    UIView *view = [[UIView alloc] init];
    UIView *rotatedView = [delegate easyTableView:self viewForHeaderInSection:section];

    if (_orientation == EasyTableViewOrientationHorizontal) {
        rotatedView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
        rotatedView.transform = CGAffineTransformMakeRotation(M_PI/2);
        view.frame = CGRectMake(0, 0, rotatedView.frame.size.height, rotatedView.frame.size.width);
        rotatedView.frame = CGRectMake(0, rotatedView.frame.size.width-rotatedView.frame.size.height, rotatedView.frame.size.width, rotatedView.frame.size.height);
    }
    else {
        rotatedView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        view.frame = CGRectMake(0, 0, rotatedView.frame.size.width, rotatedView.frame.size.height);
        rotatedView.frame = view.frame;
    }

    rotatedView.clipsToBounds = YES;

    view.clipsToBounds = YES;
    [view addSubview:rotatedView];

    return view;
}
return nil;

}

-(UIView*)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{

if ([delegate respondsToSelector:@selector(easyTableView:viewForFooterInSection:)]) {
    UIView *view = [[UIView alloc] init];
    UIView *rotatedView = [delegate easyTableView:self viewForFooterInSection:section];

    if (_orientation == EasyTableViewOrientationHorizontal) {
        rotatedView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
        rotatedView.transform = CGAffineTransformMakeRotation(M_PI/2);
        view.frame = CGRectMake(0, 0, rotatedView.frame.size.height, rotatedView.frame.size.width);
        rotatedView.frame = CGRectMake(0, rotatedView.frame.size.height-rotatedView.frame.size.width, rotatedView.frame.size.width, rotatedView.frame.size.height);
    }
    else {
        rotatedView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
        view.frame = CGRectMake(0, 0, rotatedView.frame.size.width, rotatedView.frame.size.height);
        rotatedView.frame = view.frame;
    }

    rotatedView.clipsToBounds = YES;

    view.clipsToBounds = YES;
    [view addSubview:rotatedView];

    return view;
}
return nil;

}

@alekseyn alekseyn mentioned this issue Mar 3, 2012
@alekseyn
Copy link
Owner

alekseyn commented Mar 3, 2012

I tried your suggestions but ran into an issue with orientation changes. However, with a few modifications I was able to get it working in all test cases, including device orientation changes. To ensure proper layout and sizing, header and section views for horizontal table views MUST have the same height as the horizontal table view itself. I enforce this within EasyTableView as well. Please pull the latest changes and let me know how it works out for you. Thanks for your help.

@BrandonCopley
Copy link
Contributor Author

Testing now - I just have issues because all my projects use ARC

@alekseyn alekseyn closed this as completed Mar 5, 2012
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

2 participants