슬라이더를 하위 뷰로 추가 한 tableView가 있습니다. 나는 이것을 두 가지 방법으로 시도한다.UITableView에서 테이블 다시로드하기
방법 항목 :
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
UISlider* theSlider = [[[UISlider alloc] initWithFrame:CGRectMake(174,12,120,23)] autorelease];
theSlider.maximumValue=99;
theSlider.minimumValue=0;
[cell.contentView addsubview:theSlider];
return cell;
}
문제 : 내가 이것을 사용하는 경우, 난 테이블을 이동하면 다음, 슬라이더가 &를 다시 가져 슬라이드 값보다는 나에게 최소 값을 보여줍니다. 그래서 두 번째 방법을 사용합니다.
방법 2 :이 문제
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *CellIdentifier=[NSString stringWithFormat:@"CellIdentifier%d",indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
UISlider* theSlider = [[[UISlider alloc] initWithFrame:CGRectMake(174,12,120,23)] autorelease];
theSlider.maximumValue=99;
theSlider.minimumValue=0;
[cell addSubview:theSlider];
}
return cell;
}
: 나는 그것에 탭으로 시도 내 view.When에서 다음 버튼을, 나는 최소한으로 모든 슬라이더 (즉, 설정 슬라이더 값을 다시로드하려면). 테이블을 다시로드하려고하지만 원하는 결과를 얻지 못했습니다. 당신의 버튼 콜이 줄에서 확인
[cell.contentView addSubview : theSlider]와 함께 메소드 -2를 사용하십시오. 그리고 follo Vishal의 ans. :) – iPatel
나는 또한 그 – user1673099
너 슬라이더에 대한 값을 설정해야합니다보십시오. 나는 당신이 가치를 더하고있는 곳을 보지 못한다. 최소 및 최대 값만 설정하고 있습니다. –