UILabel
YES
에 수정 하이라이팅 문제 userInteractionEnabled
의 속성을 설정하지만, 그것은 또한 터치 한 행을 선택하는 자동 스크롤로부터 UIPickerView
비활성화. 당신이 강조 동작을 비활성화하지만 UIPickerView
의 기본 자동 스크롤 기능을 유지하려면
는 UIPickerView
에 포함 된 UITableCell
경우에 setShowSelection
함수를 호출합니다. -
#import <UIKit/UIKit.h>
@interface PickerViewLabel:UILabel
{
}
@end
PickerViewLabel
PickerViewLabel.h :이 일을하는 방법은 다음과 유사한 UILabel
클래스를 서브 클래 싱하는 것입니다.m - 그럼
#import "PickerViewLabel.h"
@implementation PickerViewLabel
- (void)didMoveToSuperview
{
if ([[self superview] respondsToSelector:@selector(setShowSelection:)])
{
[[self superview] performSelector:@selector(setShowSelection:) withObject:NO];
}
}
@end
, 이전 pickerView:viewForRow:forComponent:reusingView:
에 UILabel
의 인스턴스를 반환했다, PickerViewLabel
의 인스턴스를 돌려줍니다. 예를 들어 Doug의 코드를 사용하면 'UILabel
'의 모든 사례를 'PickerViewLabel
'으로 바꿀 수 있습니다. pickerRowLabel.userInteractionEnabled = YES;
행을 삭제해야합니다.
showsSelectionIndicator는 선택기에서 반환 할 값 위에 파란색 막대를 표시합니다. 불행히도 기본 UITableViewCell 구조체와 아무런 관련이 없습니다. – Jon