首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

水准放置的tableview

2013-12-20 
水平放置的tableview////? BMViewController.m//? UITableViewTest////? Created by wangbaoxiang on 13-4

水平放置的tableview

//

//? BMViewController.m

//? UITableViewTest

//

//? Created by wangbaoxiang on 13-4-23.

//? Copyright (c) 2013年 apple. All rights reserved.

//

?

#import "BMViewController.h"

?

@interfaceBMViewController ()

?

@end

?

@implementation BMViewController

?

- (void)viewDidLoad

{

? ? [superviewDidLoad];

? ? UITableView *table? = [[UITableView alloc] initWithFrame:CGRectMake(0, 60, 60, 480)];

? ? table.backgroundColor = [UIColorwhiteColor];

? ? [table.layersetAnchorPoint:CGPointMake(0.0, 0.0)];

? ? table.transform = CGAffineTransformMakeRotation(M_PI/-2);

? ? table.showsVerticalScrollIndicator = NO;

? ? table.frame = CGRectMake(0, 60, 320, 60);

? ? table.rowHeight = 60.0;

? ? NSLog(@"%f,%f,%f,%f",table.frame.origin.x,table.frame.origin.y,table.frame.size.width,table.frame.size.height);

? ? table.delegate = self;

? ? table.dataSource = self;

? ? [self.view addSubview:table];

? ? [table release];

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{

? ? return 16;

}

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

? ? static NSString *CellIdentifier = @"Cell";

? ? UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

? ? if (cell == nil) {

? ? ? ? cell = [[[UITableViewCellalloc] initWithStyle:UITableViewCellStyleDefault

?? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? reuseIdentifier:CellIdentifier] autorelease];

? ? ? ? cell.selectionStyle = UITableViewCellSelectionStyleGray;

? ? ? ? cell.textLabel.textAlignment = NSTextAlignmentCenter;

? ? ? ? cell.textLabel.backgroundColor = [UIColorredColor];

? ? ? ? cell.textLabel.transform = CGAffineTransformMakeRotation(M_PI/2);

? ? }

? ? cell.textLabel.text = [NSString stringWithFormat:@"%d",indexPath.row];

? ? return cell;

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

? ? NSLog(@"--------->%d",indexPath.row);

}

- (void)didReceiveMemoryWarning

{

? ? [superdidReceiveMemoryWarning];

? ? // Dispose of any resources that can be recreated.

}

?

?

@end

热点排行