UISlider不在原型单元格中滑动 [英] UISlider not sliding in prototype cell

查看:64
本文介绍了UISlider不在原型单元格中滑动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Storyboard的视图控制器中设计了一个原型单元,但是不幸的是,单元中的UISlider并没有滑动.

I have designed a prototype cell in a Storyboard's view controller, but unfortunately the UISlider in the cell is not sliding.

注意:-对此情节提要板启用了自动布局.

Note:- Autolayout is enabled for this storyboard.

设计:-

以下是代码:-,用于在UITableview

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    UITableViewCell *cell;
    if(indexPath.row!=self.arrSelectRecipientsImages.count-1 )
    {

        cell = [tableView dequeueReusableCellWithIdentifier:@"selectReciptenceTabCell" forIndexPath:indexPath];

    }
    else
    {
        cell = [tableView dequeueReusableCellWithIdentifier:@"selectNearbyTabCell" forIndexPath:indexPath];
        UISlider *sliderNearby = (UISlider *)[cell.contentView viewWithTag:199];
        lblDistance = (UILabel *)[cell.contentView viewWithTag:190];
        sliderNearby.userInteractionEnabled = YES;
        [sliderNearby setThumbImage:[UIImage imageNamed:@"NearbyCircle"] forState:UIControlStateNormal];
        [sliderNearby addTarget:self action:@selector(sliderNearbyAction:) forControlEvents:UIControlEventValueChanged];
  }
return cell;
}

推荐答案

这个问题很愚蠢,我没有提供不同索引路径中单元格的高度.这就是为什么最后一个单元格(即滑块单元格)显示但它的高度是30,因此该区域之外的任何轻触或手势都没有响应.

Well, the problem was very silly, I have not provided height for cell in different index-path.That's why the last cell i.e the slider cell was showing but it's height was 30, so any tap or gesture outside that region was not responding.

这篇关于UISlider不在原型单元格中滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆