안녕하세요 여러분, 큰 문제가 있습니다. 저는 iPad 앱을 개발 중입니다. 이것에서 나는 UITableView에서 테이블 뷰 셀을 재사용했다. 이전에는 셀을 재사용하지 않았지만 작동했지만 매우 느립니다. 나는 세포를 rused 한 성능을 향상시키기 위해 지금은 매우 빠르고하지만 난 후 몇 번이나 속도를 스크롤 할 때 * EXC_BAD_ACCESS * 다음과 같은 메시지가 발생예기치 않은 EXC_BAD_ACCESS 여러 번 스크롤 UITableView
-[CALayer retain]: message sent to deallocated instance 0x5aba7b0
나는 발표되는 실제 함께 IBOutlet을 발견했다. 그것은 UIImageView입니다. 전에도 같은 문제가 셀의 UIButton에있었습니다. 나는 재산을 보유하고 그것을 선언했다. 이제 imageview 유지 선언 할 경우 작동하지만 .. 지금 셀프 홀수 또는 심지어 위치에 따라 imageViews 2 형식이 필요합니다. 이제는 연속 된 3,2,4 ...에서의 동일한 이미지 뷰를 보여줍니다. 고정되지 않은 셀. 나는 다음 코드를 도와주세요 문제 strugling 오전 :
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
Defect* defect=nil;
if(defects && [defects count]>0){
defect=[defects objectAtIndex:indexPath.row];
}
UITableViewCell *cell=nil;
cell = [tableView dequeueReusableCellWithIdentifier:defect.cellIdientifier];
NSLog(@"%@",cell.reuseIdentifier);
int row = [indexPath row];
if (cell == nil) {
NSLog(@"+++++++++++++++++++++++++++888Button=%@",assignResCellViewButton);
NSLog(@"Button=%@",subContractorSpinnerButton);
NSLog(@"Button=%@",tradeSpinnerButton);
NSLog(@"Button=%@",assignResCellNoteButton);
NSLog(@"assignResponsibilityTableCustomCell=%@",assignResponsibilityTableCustomCell);
NSLog(@"assignResCellViewButton=%@",assignResCellViewButton);
NSLog(@"assignResCellNoteButton=%@",assignResCellNoteButton);
NSLog(@"tradeSpinnerButton=%@",tradeSpinnerButton);
NSLog(@"subContractorSpinnerButton=%@",subContractorSpinnerButton);
NSLog(@"assignREsCellElementlabel=%@",assignREsCellElementlabel);
NSLog(@"assignREsCellDetailLabel=%@",assignREsCellDetailLabel);
NSLog(@"assignResImageView=%@",assignResImageView);
NSLog(@"tradeTextView=%@",tradeTextView);
NSLog(@"subContractorTextView=%@",subContractorTextView);
NSLog(@"tradeSelectedNameTextView=%@",tradeSelectedNameTextView);
NSLog(@"subContractorSelectedNameTextView=%@",subContractorSelectedNameTextView);
NSLog(@"tradeSpinnerBackgroundView=%@",tradeSpinnerBackgroundView);
NSLog(@"subcontractorSpinnerView=%@",subcontractorSpinnerView);
NSLog(@"++++++++++++++++++++999Button=%@",statusButton);
//Load Nib as per Text Length
[self getCellNibName:defect];
//[[NSBundle mainBundle] loadNibNamed:@"AssignResponsibilityCellItem" owner:self options:nil];
cell=assignResponsibilityTableCustomCell;
assignResCellViewButton.tag=VIEW_BUTTON_TAG;
assignResCellNoteButton.tag=NOTE_BUTTON_TAG;
tradeSpinnerButton.tag=TRADE_SPINNER_BUTTON_TAG;
subContractorSpinnerButton.tag=SUBCONTRACTOR_BUTTON_TAG;
assignREsCellElementlabel.tag=ELEMENT_LABEL_TAG;
assignREsCellDetailLabel.tag=DETAIL_LABEL_TAG;
assignResImageView.tag=BG_IMAGEVIEW_TAG;
tradeTextView.tag=TRADE_TEXTVIEW_TAG;
subContractorTextView.tag=SUBCONTRACTOR_TEXTVIEW_TAG;
tradeSelectedNameTextView.tag=TRADE_NAME_TEXTVIEW_TAG;
subContractorSelectedNameTextView.tag=SUBCONTRACTOR_NAME_TEXTVIEW_TAG;
tradeSpinnerBackgroundView.tag=133;
subcontractorSpinnerView.tag=134;
}
//SetTag
assignREsCellElementlabel=(UILabel*)[cell viewWithTag:ELEMENT_LABEL_TAG];
assignResCellViewButton=(UIButton*)[cell viewWithTag:VIEW_BUTTON_TAG];
assignResCellNoteButton=(UIButton*)[cell viewWithTag:NOTE_BUTTON_TAG];
assignREsCellDetailLabel=(UILabel*)[cell viewWithTag:DETAIL_LABEL_TAG];
tradeSpinnerButton=(UIButton*)[cell viewWithTag:TRADE_SPINNER_BUTTON_TAG];
subContractorSpinnerButton=(UIButton*)[cell viewWithTag:SUBCONTRACTOR_BUTTON_TAG];
subContractorTextView=(UITextView*)[cell viewWithTag:SUBCONTRACTOR_TEXTVIEW_TAG];
assignResImageView=(UIImageView*)[cell viewWithTag:BG_IMAGEVIEW_TAG];
tradeTextView=(UITextView*)[cell viewWithTag:TRADE_TEXTVIEW_TAG];
subContractorSelectedNameTextView=(UITextView*)[cell viewWithTag:SUBCONTRACTOR_NAME_TEXTVIEW_TAG];
tradeSelectedNameTextView=(UITextView*)[cell viewWithTag:TRADE_NAME_TEXTVIEW_TAG];
tradeSpinnerBackgroundView=(UITextView*)[cell viewWithTag:133];
subcontractorSpinnerView=(UITextView*)[cell viewWithTag:134];
//Set Text
assignREsCellElementlabel.text=defect.defectElement.name;
assignREsCellDetailLabel.text=defect.defectItem.name;
//set viewButton image on the basis of defectPhoto availability
assignResCellViewButton.titleLabel.text=[NSString stringWithFormat:@"%d",indexPath.row];
assignResCellNoteButton.titleLabel.text=[NSString stringWithFormat:@"%d",indexPath.row];
if(defect.defectPhoto && defect.defectPhoto.location && [StringUtil isValid:defect.defectPhoto.location]){
[assignResCellViewButton setImage:greenLenseImage forState:UIControlStateNormal];
}else{
[assignResCellViewButton setImage:lenceImage forState:UIControlStateNormal];
}
//set note button image on the basis of comment availability
if (defect.hasComments){
[assignResCellNoteButton setImage:noteExistImage forState:UIControlStateNormal];
} else {
[assignResCellNoteButton setImage:noteNotExistImage forState:UIControlStateNormal];
}
defect.tradeTextView=tradeTextView;
defect.subContractorTextView=subContractorTextView;
//Show Trade
[self decideTradeToBePlaced:defect :row];
//Show SubContractor
[self decideSubContractorToBePlaced:defect :row];
tradeSpinnerButton.titleLabel.text=[NSString stringWithFormat:@"%d",indexPath.row];
subContractorSpinnerButton.titleLabel.text=[NSString stringWithFormat:@"%d",indexPath.row];
//subContractorSpinnerButton.tag=indexPath.row;
//Set Cell Background(alternate white and gray)
// defect.tableCell= assignResponsibilityTableCustomCell;
if(indexPath.row % 2 ==0){
[assignResImageView setBackgroundColor:[UIColor whiteColor]];
}else{
[assignResImageView setBackgroundColor:[UIColor lightGrayColor]];
}
return cell;
}
: 한 가지 더 내가 그래서
#import <Foundation/Foundation.h>
#import "BaseTableDelegate.h"
@interface AssignResponsibilityTableDelegate : BaseTableDelegate {
//Assign Responsibility Table cell IBOutlet
IBOutlet UITableViewCell *assignResponsibilityTableCustomCell;
IBOutlet UIButton *assignResCellViewButton;
IBOutlet UIButton *assignResCellNoteButton;
IBOutlet UILabel *assignREsCellDetailLabel;
IBOutlet UIImageView *assignResImageView;
IBOutlet UILabel *assignREsCellElementlabel;
//Trade
IBOutlet UIView *tradeSpinnerBackgroundView;
IBOutlet UITextView *tradeTextView;
IBOutlet UITextView *tradeSelectedNameTextView;
IBOutlet UIButton *tradeSpinnerButton;
//SubContractor
IBOutlet UIView *subcontractorSpinnerView;
IBOutlet UITextView *subContractorTextView;
IBOutlet UITextView *subContractorSelectedNameTextView;
IBOutlet UIButton *subContractorSpinnerButton;
UIImage* greenLenseImage;
UIImage* lenceImage;
UIImage* noteExistImage;
UIImage* noteNotExistImage;
NSMutableArray* assignDefects;
// int cellHeight;
}
@property(nonatomic, retain)UITextView *subContractorSelectedNameTextView;
@property(nonatomic, retain)UITextView *tradeSelectedNameTextView;
@property(nonatomic, retain)UIButton *tradeSpinnerButton;
@property(nonatomic, retain)UIView *tradeSpinnerBackgroundView;
@property(nonatomic, retain)UIView *subcontractorSpinnerView;
//Assign Responsibility Table Cell Click Action
- (IBAction)tradeContractorButtonClicked:(id)sender;
- (IBAction)subContractorButtonClicked:(id)sender;
@end
는 다음 결함 객체에 cellIdientifier를 저장 한 세포의 3 종류를로드하는 것은 cellForRowAtIndexPath입니다