如何增加UIProgressView的高度
1个回答
展开全部
1. 你无法通过nib改变UIProgressView的高度。 如果你想改变的高度,那么你通过自定义需要它
2. 完成应用CGAffineTransformMakeScale(1.0F,3.0F); progressView.transform=变换;
3. 刚刚成立的中UIProgressView在代码中已经初始化之后。例如:UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
// progressView's frame will be small/standard height
progressView.frame = CGRectMake(0, 0, 100, 20);
// Now the frame is set to my custom rect.
这是工作在iOS 5。我'定制trackImage和progressImage虽然。我的代码如下所示。请注意,我添加了progressView到另一个视图,并希望它的大小为包含视图,因此设定为self.bounds。_progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
_progressView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
_progressView.trackImage = [[UIImage imageNamed:@"search-progress-track"] resizableImageWithCapInsets:UIEdgeInsetsMake(3.0f, 3.0f, 3.0f, 3.0f)];
_progressView.progressImage = [[UIImage imageNamed:@"search-progress"] resizableImageWithCapInsets:UIEdgeInsetsMake(3.0f, 3.0f, 3.0f, 3.0f)];
_progressView.frame = self.bounds;
[_progressView setProgress:0.5];
4. 这里是解决方案 你变换,但问题就出现了->当您更改设备的方向 CodeGo.net,UIProgressView高度原之一。 因此,为了提高UIProgressView高度最好的方法是yourProgressView.progressImage=[UIImage imageNamed:@"image1.png"];
yourProgressView.trackImage = [UIImage imageNamed:@"image2.png"];
// IMPORTANT: image1/image2 height (in pixel) = height that you want for yourProgressView.
// no need to set other properties of yourProgressView.
谢谢
5. 适用于iOS 5及以上你的新协议[UIAppearance appearance]
所以,你所能做的就是像[UIProgressView appearanceWhenContainedIn:[YourClass class], nil] setFrame:CGRectMake(10.0, 10.0, 300.0, 9.0]];
2. 完成应用CGAffineTransformMakeScale(1.0F,3.0F); progressView.transform=变换;
3. 刚刚成立的中UIProgressView在代码中已经初始化之后。例如:UIProgressView *progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
// progressView's frame will be small/standard height
progressView.frame = CGRectMake(0, 0, 100, 20);
// Now the frame is set to my custom rect.
这是工作在iOS 5。我'定制trackImage和progressImage虽然。我的代码如下所示。请注意,我添加了progressView到另一个视图,并希望它的大小为包含视图,因此设定为self.bounds。_progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
_progressView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth;
_progressView.trackImage = [[UIImage imageNamed:@"search-progress-track"] resizableImageWithCapInsets:UIEdgeInsetsMake(3.0f, 3.0f, 3.0f, 3.0f)];
_progressView.progressImage = [[UIImage imageNamed:@"search-progress"] resizableImageWithCapInsets:UIEdgeInsetsMake(3.0f, 3.0f, 3.0f, 3.0f)];
_progressView.frame = self.bounds;
[_progressView setProgress:0.5];
4. 这里是解决方案 你变换,但问题就出现了->当您更改设备的方向 CodeGo.net,UIProgressView高度原之一。 因此,为了提高UIProgressView高度最好的方法是yourProgressView.progressImage=[UIImage imageNamed:@"image1.png"];
yourProgressView.trackImage = [UIImage imageNamed:@"image2.png"];
// IMPORTANT: image1/image2 height (in pixel) = height that you want for yourProgressView.
// no need to set other properties of yourProgressView.
谢谢
5. 适用于iOS 5及以上你的新协议[UIAppearance appearance]
所以,你所能做的就是像[UIProgressView appearanceWhenContainedIn:[YourClass class], nil] setFrame:CGRectMake(10.0, 10.0, 300.0, 9.0]];
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询