Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/119.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
progressview未显示在ios7中_Ios_Ios7_Uiprogressview - Fatal编程技术网

progressview未显示在ios7中

progressview未显示在ios7中,ios,ios7,uiprogressview,Ios,Ios7,Uiprogressview,我通过将progressview作为子视图添加到alertview来显示progressview和标签,这在IOS6上运行良好,我在IOS7上测试了相同的内容,progressview和标签没有显示出来。下面是我的代码。要使它在ios7上工作,需要做哪些更改 alert = [[UIAlertView alloc] initWithTitle:@"Please Wait..Downloading reports..." message:nil delegate:self cancelBu

我通过将progressview作为子视图添加到alertview来显示progressview和标签,这在IOS6上运行良好,我在IOS7上测试了相同的内容,progressview和标签没有显示出来。下面是我的代码。要使它在ios7上工作,需要做哪些更改

 alert = [[UIAlertView alloc] initWithTitle:@"Please Wait..Downloading reports..."    message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] ;
alert.frame=CGRectMake(50, 50, 280, 40);
prgView = [[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleBar];
prgView.frame = CGRectMake(10, 60, 265, 20);
prgView.hidden=NO;
[alert addSubview:prgView];
statusLabel = [[UILabel alloc] init];
statusLabel.backgroundColor = [UIColor clearColor];
statusLabel.textColor = [UIColor whiteColor];
statusLabel.font = [UIFont fontWithName:@"AmericanTypewriter-Condensed" size:18.0];
statusLabel.frame = CGRectMake(120, 80, 80, 20);
[alert addSubview:statusLabel];
[alert show];

尝试使用
showInView
而不是
addSubview

[alert showInView:self.view];

尝试使用
showInView
而不是
addSubview

[alert showInView:self.view];

与OP稍有不同,是为通过搜索找到它的用户添加的。 在我的例子中,UIProgressBar是在未指定Y偏移的情况下添加到UIView的。在iOS6下,它显示在导航栏下,但在iOS7下,进度栏位于导航栏后面。我通过将进度条框架Y设置为导航条的Y+高度来解决此问题,如所示:

CGRect navframe = [[self.navigationController navigationBar] frame];
CGFloat yloc = (navframe.size.height + navframe.origin.y);

UIProgressView *progressBar = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar ];
CGRect pbFrame = progressBar.frame;
CGRect vFrame = self.view.frame;
pbFrame.size.width = vFrame.size.width;
pbFrame.origin.y = yloc;
progressBar.frame = pbFrame;

[self.view addSubview:progressBar];

与OP稍有不同,是为通过搜索找到它的用户添加的。 在我的例子中,UIProgressBar是在未指定Y偏移的情况下添加到UIView的。在iOS6下,它显示在导航栏下,但在iOS7下,进度栏位于导航栏后面。我通过将进度条框架Y设置为导航条的Y+高度来解决此问题,如所示:

CGRect navframe = [[self.navigationController navigationBar] frame];
CGFloat yloc = (navframe.size.height + navframe.origin.y);

UIProgressView *progressBar = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleBar ];
CGRect pbFrame = progressBar.frame;
CGRect vFrame = self.view.frame;
pbFrame.size.width = vFrame.size.width;
pbFrame.origin.y = yloc;
progressBar.frame = pbFrame;

[self.view addSubview:progressBar];

不允许您从iOS7向
UIAlertView
UIActonSheet
添加任何子视图,您应该找到另一种方法。哦..好的。。谢谢holex。。你知道这背后的原因吗?我认为这与用户隐私有关,因为许多应用程序都做到了这一点:没有用户的明确意愿,他们自动选择了这个或那个选项(不仅在UIAlertView中),这是不公平的行为,例如在IAP的情况下;因此,我猜他们想限制对系统相关控件的访问,这将是程序的开始。@RockandRoll您找到解决此问题的方法了吗?您不允许从iOS7向
UIAlertView
UIActonSheet
添加任何子视图,您应该找到另一种方法。哦..好的。。谢谢holex。。你知道这背后的原因吗?我认为这与用户隐私有关,因为许多应用程序都做到了这一点:没有用户的明确意愿,他们自动选择了这个或那个选项(不仅在UIAlertView中),这是不公平的行为,例如在IAP的情况下;因此,我猜他们喜欢限制对系统相关控件的访问,这将是程序的开始。@RockandRoll你找到过解决这个问题的方法吗?我在UIAlertView中没有找到“ShowInView”方法,你是如何做到的?我在UIAlertView中没有找到“ShowInView”方法,你是如何做到的?