XCODE 4.2로 업그레이드되었으며 갑자기 이러한 경고 신호가 나타납니다. 대부분 나는 고칠 수 있지만 다음은 어떻게해야할지 모르겠다. 나는 그것을 읽기 위해 노력했지만 여전히 문제가있다. 사용되지 않습니다해결 방법 : initWithFrame : CellFrame reuseIdentifier : cellIdentifier 권장되지 않음
코드는 다음과 같습니다
UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CellFrame reuseIdentifier:cellIdentifier] autorelease];
나는 내가 다음 사용할 필요가 있음을 알고 난 테스트 할 때
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
그러나, 난 등 CellFrame으로 문제를 얻는다.
누군가 내가 depWired 코드를 initWithStyle로 대체하고 동일한 결과를 얻는 방법에 대한 힌트를 줄 수 있습니까?
여기에 전체 코드입니다 :
- (UITableViewCell *) getCellContentView:(NSString *)cellIdentifier {
CGRect CellFrame = CGRectMake(0, 0, 300, 60);
CGRect Label1Frame = CGRectMake(10, 10, 290, 25);
CGRect Label2Frame = CGRectMake(30, 33, 270, 25);
CGRect Label3Frame = CGRectMake(30, 56, 270, 25);
UILabel *lblTemp;
UITableViewCell *cell = [[[UITableViewCell alloc] initWithFrame:CellFrame reuseIdentifier:cellIdentifier] autorelease];
//Initialize Label with tag 1.
lblTemp = [[UILabel alloc] initWithFrame:Label1Frame];
lblTemp.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.3f alpha:1.0f];
lblTemp.textColor = [UIColor whiteColor];
lblTemp.backgroundColor = [UIColor clearColor];
[lblTemp setFont:[UIFont fontWithName:@"American Typewriter" size:16]];
lblTemp.tag = 1;
[cell.contentView addSubview:lblTemp];
[lblTemp release];
//Initialize Label with tag 2.
lblTemp = [[UILabel alloc] initWithFrame:Label2Frame];
lblTemp.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.3f alpha:1.0f];
lblTemp.tag = 2;
[lblTemp setFont:[UIFont fontWithName:@"American Typewriter" size:13]];
lblTemp.textColor = [UIColor whiteColor];
lblTemp.backgroundColor = [UIColor clearColor];
[cell.contentView addSubview:lblTemp];
[lblTemp release];
//Initialize Label with tag 3.
lblTemp = [[UILabel alloc] initWithFrame:Label3Frame];
lblTemp.backgroundColor = [UIColor colorWithRed:0.0f green:0.0f blue:0.3f alpha:1.0f];
lblTemp.tag = 3;
[lblTemp setFont:[UIFont fontWithName:@"American Typewriter" size:13]];
lblTemp.textColor = [UIColor whiteColor];
lblTemp.backgroundColor = [UIColor clearColor];
[cell.contentView addSubview:lblTemp];
[lblTemp release];
return cell;
}
우리에게 당신이 initWithStyle를 사용하여 시도 코드를 보여이 코드를 사용하고, 우리에게 당신이있어 오류를 보여줍니다. –