I am using tableview and using Custum cell.I am seting a label . My first row of table is empty.label are on starting with second row. And after scrolling upward label became disappear.And scrolling downward label appear.How we resolve this problem. on view did Load
self.automaticallyAdjustsScrollViewInsets = NO;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"CustumCell";
CustumCell *cell = (CustumCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustumCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(20, 0, 200 ,200 )];
label.text=@"hello";
[cell.contentView addSubview:label];
return cell;
}
- (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 40;
}
0 comments:
Post a Comment