我在cellForRowAtIndexPath:方法中有一些條件代碼。它似乎是在iOS6的,但在隨後的iOS 7工作正常細胞按鈕有三個點鼠標懸停在... cellforRowAtIndexPath中的條件代碼:無法正常工作
它似乎也像他們可能在其他的每一個都可以添加一個按鈕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];
}
你的條件代碼看起來很好(如果我們忽略所有這些幻數),我認爲這個問題必須來自其他地方! – micantox
謝謝!是否有可能在表格視圖單元格的uibutton上添加一個uibutton? – user2588945