Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2610833
  • 博文数量: 877
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 5921
  • 用 户 组: 普通用户
  • 注册时间: 2013-12-05 12:25
个人简介

技术的乐趣在于分享,欢迎多多交流,多多沟通。

文章分类

全部博文(877)

文章存档

2021年(2)

2016年(20)

2015年(471)

2014年(358)

2013年(26)

分类: iOS平台

2015-08-28 17:07:02

//
//  ViewController.m
//  FontTableViewDemo
//
//  Created by lenovo on 15/8/28.
//  Copyright (c) 2015??? Wicresoft. All rights reserved.
//


#import "ViewController.h"


@interface ViewController ()


@end


@implementation ViewController


- (void)loadView
{
    //[super loadView];
    
    
    //UIView * mainview = [[UIView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame];
    //UIImageView * backgroundView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"IMG_0410"]];
    //mainview.backgroundColor = [UIColor clearColor];
    //self.view = mainview;
    
    _listArray = [UIFont familyNames];
    //_tableView = [[UITableView alloc] initWithFrame:mainview.bounds style:UITableViewStylePlain];
   // _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStyleGrouped];
    //_tableView = [[UITableView alloc] init];
    _tableView = [[UITableView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame] style:UITableViewStylePlain];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    //_tableView.rowHeight = 70;
    UIImageView * backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"IMG_0410"]];
    //[mainview addSubview:backgroundView];
    
    UIWindow * window = [[UIApplication sharedApplication] keyWindow];
    window.rootViewController = self;
    self.view = _tableView;
    //[self.view addSubview:_tableView];
    _tableView.backgroundView = backgroundView;
    //_tableView.
    
    //[self.view addSubview:_tableView];
   //[self.view addSubview:_tableView];
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - TableView DataSources
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [_listArray count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString * cellIdentifier = @"cell";
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
        if(cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        
        
        cell.backgroundColor = [UIColor clearColor];//不加此行不会透明
        //cell.contentView.backgroundColor = [UIColor purpleColor];
        
         //cell.contentView.alpha = 0.0;
        //cell.alpha = 0.0;
        //cell.backgroundView.alpha = 0.0;
        //cell.textLabel.alpha = 0.0;
        
        


    }
    NSLog(@"indexPath : %ld", (long)indexPath.row);
    NSString * fontName = _listArray[indexPath.row];
    cell.textLabel.text =fontName;
    cell.textLabel.font = [UIFont fontWithName:fontName size:14];
    return cell;
    
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"The section is %ld",indexPath.section);
    NSLog(@"The row is %ld", indexPath.row);
}


- (void)dealloc
{
    [self setTableView:nil];
    [self setListArray:nil];
}


@end

阅读(865) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~