2014-05-24 71 views
1


我有我班UITableView,當我試圖加載的內容時,出現了屏幕像這樣的UITableView細胞ImageView的問題

enter image description here

下面的白框是無法看到的水平分隔線,請幫助我。

我的代碼:在你看來沒有負載

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
    return 1; //count of section 
} 


- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 

    return [names count]; //count number of row from counting array hear cataGorry is An Array 
} 


- (UITableViewCell *)tableView:(UITableView *)tableView 
     cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *MyIdentifier = @"service"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; 

    if (cell == nil) 
    { 
     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 
             reuseIdentifier:MyIdentifier] 
     ; 
    } 

    // Here we use the provided setImageWithURL: method to load the web image 
    // Ensure you use a placeholder image otherwise cells will be initialized with no image 
    cell.imageView.frame=CGRectMake(5,10,50,60); 
    cell.imageView.image=[imaages objectAtIndex:indexPath.row]; 
    cell.textLabel.text = [names objectAtIndex:indexPath.row]; 
    cell.backgroundColor=[UIColor clearColor]; 
    return cell; 
} 

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 

    return 80; 

} 
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ 
} 

回答

4

在iOS系統7及更高版本,電池隔板不要一路延伸到表view.This財產的邊緣設置表格中所有單元格的默認插入,就像rowHeight設置單元格的默認高度一樣。它也用於管理在普通樣式表底部繪製的「額外」分隔符。

// Do any additional setup after loading the view. 
if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) { 
    [_tableView setSeparatorInset:UIEdgeInsetsZero]; 
} 
+0

確定讓我來試試現在 – Bangalore

+0

沒有......還是它不工作 – Bangalore

+0

_tabview是你的表視圖對象,可能是你的情況self.tableView。試試吧 – Pawan