iOS之UITableView的使用——静态单元格
2015-01-06 14:46
267 查看
1、新建Cocoa Touch Class对象,继承自UITableViewController
2、删除原来storyboard的view,新添加UITableViewController控件
3、将表格属性中的Content属性改为static cells,不需要UIDataSource
代码:
.h
#import <UIKit/UIKit.h>
@interface FKTableViewController : UITableViewController
@property (strong, nonatomic) IBOutlet UILabel *label2;
@property (strong, nonatomic) IBOutlet UILabel *label1;
@property (strong, nonatomic) IBOutlet UIImageView *iv;
@end
.m
#import "FKTableViewController.h"
@interface FKTableViewController ()
@end
@implementation FKTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.label1.text = @"作者的图书";
self.label2.text = @"作者的简历";
self.iv.image = [UIImage imageNamed:@"stars.gif"];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
2、删除原来storyboard的view,新添加UITableViewController控件
3、将表格属性中的Content属性改为static cells,不需要UIDataSource
代码:
.h
#import <UIKit/UIKit.h>
@interface FKTableViewController : UITableViewController
@property (strong, nonatomic) IBOutlet UILabel *label2;
@property (strong, nonatomic) IBOutlet UILabel *label1;
@property (strong, nonatomic) IBOutlet UIImageView *iv;
@end
.m
#import "FKTableViewController.h"
@interface FKTableViewController ()
@end
@implementation FKTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.label1.text = @"作者的图书";
self.label2.text = @"作者的简历";
self.iv.image = [UIImage imageNamed:@"stars.gif"];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
相关文章推荐
- iOS UITableView的使用大全
- IOS开发~UISCrollView与UITableView嵌套使用终极解决方案
- IOS 表视图(UITableVIew)的使用方法(4)自定义表视图单元
- iOS开发UI篇—UITableview控件使用小结
- IOS 表视图(UITableVIew)的使用方法(8)表视图的编辑功能(多选)
- ios--UITableview的基本使用方法
- IOS学习:UITableView使用详解3 分组表的简单使用
- IOS 表视图(UITableVIew)的使用方法(5)表视图的编辑功能(删除)
- iOS 表视图(UITableVIew)的使用方法(1)表视图的示例
- [IOS]UITableView重用(使用多个自定义Cell)
- iOS 之 UITableView 使用索引
- IOS 学习:UITableView 使用详解1
- iOS开发>>>UITableView下拉刷新控件的使用
- IOS 表视图(UITableVIew)的使用方法(6)表视图的编辑功能(新增Add)
- iOS UITableView的使用大全
- ios 中使用 Search Display Controller 来对 UITableView 进行前台查询
- IOS UITableView表视图和导航控制器的交互使用
- iOS7中UITableView中cell的使用
- IOS开发~UISCrollView与UITableView嵌套使用终极解决方案
- IOS 表视图(UITableVIew)的使用方法(7)表视图的编辑功能(拖拉调整排序位置)