`
zjjzmw1
  • 浏览: 1352548 次
  • 性别: Icon_minigender_1
  • 来自: 开封
社区版块
存档分类
最新评论

水平放置的tableview

    博客分类:
  • iOS
阅读更多

//

//  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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics