您的位置:首页 > 产品设计 > UI/UE

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息