I have these two views that i would like to align to be centered.
self.loadingView = [[UIView alloc] initWithFrame:CGRectMake(75, 155, 120, 120)];
self.loadingView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
self.loadingView.clipsToBounds = YES;
self.loadingView.layer.cornerRadius = 10.0;
self.activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
self.activityView.frame = CGRectMake(65, 40, self.activityView.bounds.size.width, self.activityView.bounds.size.height);
[self.loadingView addSubview:self.activityView];
loadingView needs to be aligned center to the iPhones screen. This means a code that can support different sizes of screens. And then activityView should be aligned centered inside the loadingView.
I have tried some code examples but none worked. And it was really confusing. If someone could provide some code exampels and explaing a bit how it works to get a hang of this.
Aucun commentaire:
Enregistrer un commentaire