我所創建的表視圖動態,在的cellForRowAtIndexPath我已經加在小區中的一個自定義按鈕作爲一個子視圖UITableViewCell的問題,同時滾動
if ([deviceNameArray count]!=0)
{
pairButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
pairButton.frame = CGRectMake(230.0f, 10.0f, 70.0f, 25.0f);
[pairButton setTitle:@"Connect" forState:UIControlStateNormal];
pairButton.titleLabel.textColor = [UIColor lightGrayColor];
pairButton.titleLabel.textAlignment = NSTextAlignmentCenter;
pairButton.titleLabel.font = [UIFont fontWithName:@"arial" size:10];
pairButton.tag = indexPath.row;
[pairButton addTarget:self action:@selector(connectToDevice:) forControlEvents:UIControlEventTouchUpInside];
[cell addSubview:pairButton];
isPairButtonAdded = YES;
}
我已經改變了設備的按鈕標題斷開連接後成功與我的另一設備。現在的問題是,無論何時滾動我的表格斷開連接變成連接,但我不希望發生這樣的事情,我知道它由於細胞娛樂如何停止重新創建細胞。
把整個implementa - tableView:cellForRowAtIndexPath: – Moxy