//
// 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
阅读(886) | 评论(0) | 转发(0) |