I have a view in Which I have added a UIScrollview. In UIScrollView I added an UIImageView. After Picking Image from ImagePicker I am adding image to UIImageView.
Problem : I am showing UIActivityIndicatorView before adding image to ImageView.
Case 1: When I add activity Indicator to self.view It is showing behind the UIScrollView means not showing at all.
Case 2: If I add Indicator to Scrollview it is not adding in view.
I tried many thing bringSubviewToFront , insertSubview:indicator aboveSubview:myscrollview
Here is my CODE :
scroller = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 60, Screen_width, Screen_height - 60)];
scroller.delegate = self;
[self.view addSubview:scroller];
scroller.contentSize = CGSizeMake(Screen_width, 667);
profileImageView = [[UIImageView alloc]initWithFrame:CGRectMake(20, 10, Screen_width-40, Screen_width-40)];
profileImageView.backgroundColor = gray;
profileImageView.contentMode = UIViewContentModeScaleAspectFill;
profileImageView.clipsToBounds = YES;
profileImageView.userInteractionEnabled=YES;
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
_profileIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
_profileIndicator.frame = CGRectMake(40.0, 20.0, 60.0, 60.0);
_profileIndicator.center = self.view.center;
[self.view addSubview:_profileIndicator];
[_profileIndicator startAnimating];
}