Created
January 6, 2013 06:28
-
-
Save lerosua/4465630 to your computer and use it in GitHub Desktop.
创建一个横向的tableview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
创建前先设定tableview的rowHeight,然后旋转。 | |
每个row的高度即为旋转后的宽度。然后在cellWillDisplay里旋转一下cell就可以了。 | |
- (UITableView *)payTableView { | |
if(!_payTableView){ | |
_payTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, 320, 320) style:UITableViewStylePlain]; | |
_payTableView.backgroundColor = [UIColor clearColor]; | |
_payTableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
_payTableView.showsVerticalScrollIndicator = NO; | |
_payTableView.delegate = self; | |
_payTableView.dataSource = self; | |
_payTableView.rowHeight = 320.0; | |
_payTableView.transform = CGAffineTransformMakeRotation(-1.5707963); | |
_payTableView.frame = CGRectMake(12, 226, 320, 44); | |
_payTableView.pagingEnabled = YES; | |
} | |
return _payTableView; | |
} | |
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ | |
return 160; | |
} | |
- (void)tableView:(UITableView *) tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ | |
cell.transform = CGAffineTransformMakeRotation(1.5707963); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment