Uitableview 自定义表格视图单元格带背景图像-宽度问题
我有一个自定义单元格(在IB中设置),背景图像宽度为320px。单元的宽度也是320。当我运行我的应用程序时,单元格右侧大约有5像素的白色。换句话说,我的图像没有覆盖整个屏幕的宽度。我的代码如下所示:Uitableview 自定义表格视图单元格带背景图像-宽度问题,uitableview,width,Uitableview,Width,我有一个自定义单元格(在IB中设置),背景图像宽度为320px。单元的宽度也是320。当我运行我的应用程序时,单元格右侧大约有5像素的白色。换句话说,我的图像没有覆盖整个屏幕的宽度。我的代码如下所示: - (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath { static NSString *OffensivePlaye
- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {
static NSString *OffensivePlayerCellIdentifier = @"OffensivePlayerCellIdentifier";
OffensivePlayerCell *cell = (OffensivePlayerCell *)[tableView dequeueReusableCellWithIdentifier: OffensivePlayerCellIdentifier];
if( cell == nil ) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed: @"OffensivePlayer" owner: self options: nil];
cell = [nib objectAtIndex: 0];
}
return cell;
}
有什么想法吗?嗯,我没有直接将图像应用于单元格的背景,而是尝试添加一个图像视图并将图像应用于该单元格。现在它起作用了。不知道为什么。奇怪的行为