#import "MyTableViewController.h"
@interface MyTableViewController ()
@property(nonatomic,retain)NSMutableArray *arr;
@end
@implementation MyTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.arr = [NSMutableArray arrayWithObjects:@"宋江", @"卢俊义", @"吴用", @"公孙胜", @"关胜", @"林冲", @"秦明" ,@"呼延灼" , @"花荣",@"柴进", @"李应", @"朱仝",@"鲁智深",@"武松", @"徐宁", @"张清", @"杨志", @"董平", @"索超", @"戴宗", @"刘唐", @"李逵", @"史进", @"穆弘", @"雷横", @"李俊",nil];
tableView的对cell的注册
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"reuse"];
self.refreshControl=[[UIRefreshControl alloc] init];
[self.refreshControl addTarget:self action:@selector(refresh:) forControlEvents:UIControlEventValueChanged];
}
-(void)refresh:(UIRefreshControl *)control{
NSLog(@"11111");
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.arr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuse" forIndexPath:indexPath];
cell.textLabel.text=self.arr[indexPath.row];
return cell;
}
tableView简化写法
最新推荐文章于 2016-05-26 14:05:57 发布