0
我已經創建了一個自定義單元格並在其上添加了一個uibutton。點擊該按鈕,即可設置選擇哪個按鈕來更改按鈕的圖像。一個單元格內容的變化會改變其他單元格以及UITableView
-(IBAction)btnInfoPressed:(id)sender
{
[btnInfo setSelected:YES];
}
上述方法在自定義單元類中。現在當我向下滾動時,在一些單元格之後,即使我沒有敲擊那個按鈕,也會選擇其他單元格的按鈕。
這裏是我的cellForRowAtIndexPath方法:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"CustomCell";
CustomCell *c = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (c == nil)
{
c = [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] objectAtIndex:0];
}
c.selectionStyle = UITableViewCellSelectionStyleNone;
return c;
}
任何想法需要它做什麼?
顯示方法'[btnInfo setSelected:YES]'。 – Geek
其默認的UIButton屬性將其狀態從Normal改爲已選或恢復正常。 – iAmd
那麼你不應該使用'[發件人setSelected:YES]'? – Geek