iOS之UITableView的使用——静态单元格

来源:互联网 发布:手机定位软件开发 编辑:程序博客网 时间:2024/05/18 06:08

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


0 0
原创粉丝点击