2013-05-24 2 views
0

Table View에 STHorizontalPicker 오픈 소스 코드를 구현하려고합니다. XCode 4.6.2를 사용하고 있습니다. 나는 석영 코어 프레임 워크를 가져온과 cellForRowAtIndexPath:(NSIndexPath *)indexPathiOS에서 STHorizontalPicker 구현 관련 문제

{ 
    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    STHorizontalPicker *horizontalPickerView = [[STHorizontalPicker alloc] initWithFrame:cell.frame]; 
    horizontalPickerView.name = @"myPicker"; 
    [horizontalPickerView setMinimumValue:0.0]; 
    [horizontalPickerView setMaximumValue:100.0]; 
    [horizontalPickerView setSteps:100]; 
    [horizontalPickerView setDelegate:self]; 
    [horizontalPickerView setValue:50.0]; 

    cell.textLabel.text = [myArray objectAtIndex:indexPath.row]; 

    return cell;  
} 
+0

귀하의 질문은 무엇입니까? – limon

+0

가로 피커보기를 표시 할 수 없습니다. 나는 하위 뷰를 추가하여 피커 뷰를 표시해야한다고 생각하지만 그 방법을 모른다. – Shreek

+0

'[cell.contentView addSubview : horizontalPickerView]'시도 했습니까 – limon

답변

0

당신은 점점 오류를 언급하지 않는이 코드를 구현,하지만 난 그냥 내 자신의 프로젝트 중 하나에이를 가져올 때 발생한 것입니다.

GitHub에서 현재 버전의 STHorizontalPicker는 수동 보유/해제를 사용합니다. 이것은 메모리 관리의 현재 선호되는 방법 인 자동 참조 카운팅 (ARC)과 호환되지 않습니다.

감사하게도 Xcode에서 이전 코드를 ARC로 변환하는 쉬운 방법이 있습니다.

파일을 Xcode로 가져온 후 편집 -> 리팩터링 -> Objective-C ARC로 변환을 선택하십시오. 마법사가 나타나고 첫 번째 단계에서 STHorizontalPicker.m을 선택한 다음 기본 설정으로 마법사를 진행합니다.

+0

그냥 가로 피커를 표시 할 수 없습니다. 나는 그 오류를 수정했으나 release/dealloc 메소드를 제거했다. – Shreek