alekseyn/EasyTableView — Issue #14: rotation multiple sections
Author: BrandonCopley
Created: 2012-03-02 00:34:28+00:00
State: open

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;
}