English 中文(简体)
UISlider 习俗形象和umb高?
原标题:UISlider custom images and thumb height?

我正在创造(或试图)一种习俗,即UISlider,但仍然是横向的,但又是很大的taller。 我有两个问题。

1. 导言 这是用Im法把图像传给后代。

UIImage *minImage = [UIImage imageNamed:@"sliderMin.png"];
UIImage *maxImage = [UIImage imageNamed:@"sliderMax.png"];
UIImage *thumbImage = [UIImage imageNamed:@"sliderThumb.png"];

minImage = [minImage stretchableImageWithLeftCapWidth:33.0 topCapHeight:0.0];
maxImage = [maxImage stretchableImageWithLeftCapWidth:33.0 topCapHeight:0.0];
// thumbImage = [minImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];

[_contrastSlider setMinimumTrackImage:minImage forState:UIControlStateNormal];
[_contrastSlider setMaximumTrackImage:maxImage forState:UIControlStateNormal];
[_contrastSlider setThumbImage:thumbImage forState:UIControlStateNormal];

minImage = nil;
maxImage = nil;
thumbImage = nil;

[_contrastSlider setMinimumValue:0.0];
[_contrastSlider setMaximumValue:100.00];
[_contrastSlider setValue:25.0];

我有三种图像,即min、max和.。 这些图像以及它们如何看待这些装置,这是正确的。

这里,我可以打上海报形象:MYSlider.jpeg<<><<>>>><<>>>>>>>

梯子应该对th子的权利,对左侧的ink子。 但是,情况并非如此。

That s problem 1. Problem 2 is the thumb size default is too small. I m using this :UISlider Height Hack to try to increase the height of the thumb, but sadly it s making it wider not taller. So I am asking for help to make the area taller, not wider, and wondering why my pink image is being ignored?

感谢你提供的任何帮助。

如果得到帮助,这里是我的UISlider子级:

-(BOOL) pointInside:(CGPoint)point withEvent:(UIEvent*)event {
CGRect bounds = self.bounds;
bounds = CGRectInset(bounds, -10, -8);
return CGRectContainsPoint(bounds, point);

}

-(BOOL) beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event {
  CGRect bounds = self.bounds;
  float thumbPercent = (self.value - self.minimumValue) / (self.maximumValue - self.minimumValue);
  float thumbPos = THUMB_SIZE + (thumbPercent * (bounds.size.width - (2 * THUMB_SIZE)));
  CGPoint touchPoint = [touch locationInView:self];
  return (touchPoint.x >= (thumbPos - EFFECTIVE_THUMB_SIZE) && touchPoint.x <= (thumbPos + EFFECTIVE_THUMB_SIZE));
}

谢谢。

最佳回答

这反过来又把我更精彩的价值观放在了确实的负荷方法中,造成了问题。 我将其安排在Interface Buildinger,这是固定的。 一旦在IB中确定,如果需求不成问题,我就能够将其打碎。

至于我的另一个问题,我不禁要问,这是否是因为我不试验一个实际装置,所以我会把这个问题搁置起来,直到我几周内才拿到这个装置。

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签