1

有没有办法读取 Interface Builder 的属性检查器中规定的 UISlider 的最大值和最小值?我想将这些值用作 UIView 中 X 坐标的范围,但我不确定如何执行此操作。

- (IBAction)sineXYPad:(UIPanGestureRecognizer *)trigger {
    float sinepadHeight = sinexyview.bounds.size.height;
    float sinepadWidth = sinexyview.bounds.size.width;
    CGPoint location = [trigger locationInView:sinexyview];

    if ((location.y >= 0) && (location.y < sinepadHeight) && (location.x >= 0) && (location.x < sinepadWidth)) {
        float maxX = sinePSlider.maximumValue;
        float minX = sinePSlider.minimumValue;
        float sinePitchXY = (location.x > minX) && (location.x < maxX);
        sinePSlider.value = sinePitchXY;
        [PdBase sendFloat:sinePitchXY toReceiver:@"sine_pitch"];
    }
}

这是我的用户界面:

在此处输入图像描述

4

1 回答 1

0

尝试:

[sinePSlider setMinimumValue:sinexyview.bounds.origin.x];
[sinePSlider setMaximumValue:sinexyview.bounds.size.width];
于 2013-04-21T18:42:18.263 回答