开发者

UIProgressView defaulting to top left corner of main view

My UIProgressView is going to the top right hand corner of the main view - even though I set it as a subview of a UIView (which in turn is a subview of the main view). And even if I setFrame:.

Any ideas?

if(downloadBar == nil){
  downloadBar = [[UIProgressView alloc] initWithFrame:CGRectMake(10, 10, 200, 10)];
}
[downloadBar setProgressViewStyle开发者_开发百科:UIProgressViewStyleDefault];
[downloadBar setProgress:([download downloadStatus]/100.0f)];
[downloadView addSubview:downloadBar];



// download view initialisation
// this is initalised BEFORE the download bar
    downloadView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 300, 300)];
        [downloadView setBackgroundColor:[UIColor lightGrayColor]];
        [self.view addSubview:downloadView];
        [downloadView retain];

Thanks


I think it depends on your downloadView. Because the origin coordinate (0, 0) of downloadBar will be at the same position of the origin coordinate (0, 0) of the downloadView. So, if you downloadView is located in top right, the downloadBar will be the same

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜