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