我在cellForRowAtIndexPath:方法中有一些条件代码。它似乎在iOS6中正常工作,但在iOS 7中,单元格按钮有三个点悬停在它们上面......
在满足每个if语句的条件时,似乎他们可能会在另一个按钮上添加一个按钮。
if (cell == nil) { }
之后我有以下代码
因为我需要检查每个表格单元格行的条件代码的类别id值
NSNumber * catId = [[self.listingNodesArray objectAtIndex:indexPath.row] objectForKey:@“category_id”];
if ([catId isEqualToNumber:[NSNumber numberWithInt:9]] && (a == 0)) {
cell.cornerImageView.image = [UIImage imageNamed:@"cellComprareCorner.png"];
[cell.salvaBtn setBackgroundImage:[UIImage imageNamed:@"home_verde_commentsOFF.png"]
forState:UIControlStateNormal];
}
else if ([catId isEqualToNumber:[NSNumber numberWithInt:9]] && (a != 0)) {
cell.cornerImageView.image = [UIImage imageNamed:@"cellComprareCorner.png"];
[cell.salvaBtn setBackgroundImage:[UIImage imageNamed:@"home_verde_commentsON.png"]
forState:UIControlStateNormal];
}
if ([catId isEqualToNumber:[NSNumber numberWithInt:9]] && (b == 0)) {
[cell.likeBtn setBackgroundImage:[UIImage imageNamed:@"home_verde_likeOFF.png"]
forState:UIControlStateNormal];
}
else if ([catId isEqualToNumber:[NSNumber numberWithInt:9]] && (b != 0)) {
[cell.likeBtn setBackgroundImage:[UIImage imageNamed:@"home_verde_likeON.png"]
forState:UIControlStateNormal];
}
if ([catId isEqualToNumber:[NSNumber numberWithInt:10]] && (a == 0)) {
cell.cornerImageView.image = [UIImage imageNamed:@"cellBlueCorner.png"];
[cell.salvaBtn setBackgroundImage:[UIImage imageNamed:@"home_blu_commentsOFF.png"]
forState:UIControlStateNormal];
}
else if ([catId isEqualToNumber:[NSNumber numberWithInt:10]] && (a != 0)) {
cell.cornerImageView.image = [UIImage imageNamed:@"cellComprareCorner.png"];
[cell.salvaBtn setBackgroundImage:[UIImage imageNamed:@"home_blu_commentsON.png"]
forState:UIControlStateNormal];
}
if ([catId isEqualToNumber:[NSNumber numberWithInt:10]] && (b == 0)) {
[cell.likeBtn setBackgroundImage:[UIImage imageNamed:@"home_blu_likeOFF.png"]
forState:UIControlStateNormal];
}
else if ([catId isEqualToNumber:[NSNumber numberWithInt:10]] && (b != 0)) {
[cell.likeBtn setBackgroundImage:[UIImage imageNamed:@"home_blu_likeON.png"]
forState:UIControlStateNormal];
}
答案 0 :(得分:0)
您必须删除XIB文件中的按钮标题文本。
出现这三个点是因为按钮标题文本大于按钮大小,因此显示省略号。
答案 1 :(得分:0)
请确保您的按钮标题已从XIB文件中删除。它对我有用。