动态代理使用方法
我de名字 2015-03-25 11:24:20 这边说<UITableViewDataSource,UITableViewDelegate>这个是动态代理的意思
然后下面可以重新修改里面的方法了
麻烦详细讲下原理 和过程,尤其是动态代理的用法和原理。,然后说明下下面那段代码大概是什么作用?
120分
@interface BabyReadViewController ()<UITableViewDataSource,UITableViewDelegate>
#pragma mark - TableView
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _mutarrDataList.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 100;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CommonCell = @"CommonCell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CommonCell];
if (cell == nil)
{
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CommonCell];
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 100, 30)];
lbl.tag = TAG_LABLE_NAME;
[cell.contentView addSubview:lbl];
}
BabyReadBean *bean = [_mutarrDataList objectAtIndex:indexPath.row];
UILabel *lbl = (UILabel *)[cell viewWithTag:TAG_LABLE_NAME];
lbl.text = bean.strName;
return cell;
}