您的位置:首页 > 其它

横向头像布局

2016-02-15 11:26 267 查看
@interface
ViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)UITableView *tableView;

@end

@implementation ViewController

- (void)viewDidLoad {

[super
viewDidLoad];

self.view.backgroundColor =[UIColor
whiteColor];

_tableView =[[UITableView
alloc]initWithFrame:CGRectMake(0,
0, 320,
50)style:UITableViewStylePlain];

//_tableView.center =self.view.center;

_tableView.delegate =
self;

_tableView.dataSource =self;

_tableView.transform =CGAffineTransformMakeRotation(-M_PI
/2);

_tableView.showsVerticalScrollIndicator =
NO;
[self.view
addSubview:_tableView];

}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
*)indexPath
{

UITableViewCell *cell = [tableView
dequeueReusableCellWithIdentifier:@"identifier"];

if (cell == nil) {

cell = [[UITableViewCell
alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"identifier"];
cell.backgroundColor =[UIColor
redColor];

// cell顺时针旋转90度

cell.contentView.transform =
CGAffineTransformMakeRotation(M_PI /
2);
}

return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath
*)indexPath
{

return 50;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

return 5;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{

return 10;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: