无法调整iOS 5.0中的活动指标?
在我的通用应用程序中,在iPAd部分,我正在调整活动指示器的大小…
我想调整我的活动指标
但是,真的有第一个iOS的问题是我的代码…
-(void)startSpinner { spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; /*spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; */ spinner.hidden = NO; NSLog(@"Start Spinner"); if([self isPad]) spinner.frame = CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2,100, 100); else spinner.frame = CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/2,50, 50); NSLog(@"Dpinner size %f",spinner.frame.size.width); [spinner setHidesWhenStopped:YES]; [self.view addSubview:spinner]; [self.view bringSubviewToFront:spinner]; /*1*/ **[spinner setColor:[UIColor blackColor]];** [spinner startAnimating]; }
问题1:
iOS 5.0:它显示我的活动指标,但无法调整它。 isPAd方法中大小不变。
iOS 4.3:在改变颜色的时候会给我一个Signal Abort Error。 / 1 /用粗体代码设置颜色。 这里如果我在WhiteLargeStyle的 iOS 5.0中删除setColor,它不会在白色背景中显示我。
这里如果我使用像灰色的活动指示器风格,它在iPAd.works中是绝对小的,但是不能resize。
在iOS 4.3的框架得到的效果,但IOS 5.0帧无效…
那么,我应该如何调整活动指标…
考虑使用自定义进度指示器,因为它会给予更多的灵活性。
我正在使用MBProgressHUD ,这对我来说很简单。
你可以在这里得到它 – https://github.com/jdg/MBProgressHUD
尝试设置活动指示器的CGAffineTransform:
CGAffineTransform transform = CGAffineTransformMakeScale(1.5f, 1.5f); activityIndicator.transform = transform;
在我的iPad应用程序中这样做,它在两个ios工作正常
CGRect frame = CGRectMake(300,75,100,100); UIActivityIndicatorView *act = [[UIActivityIndicatorView alloc] initWithFrame:frame]; [act startAnimating]; act.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray; //[act sizeToFit]; act.tag=kActTag; mainImage.enabled=TRUE; [mainImage addSubview:act]; [act release]; act=nil;
@Arpit
Color属性可用于iOS 5.0及更高版本。 预计在iOS4.3错误!
谢谢