I've been trying to create a `for` loop which take `UILabel.text` and merge it into an `UIImage` then save it into an instance and then when getting into the `for` loop second time it would save the result in different instance.

The problem that I'm facing is that it is saving the first `UIImage` but with low quality and skipping the second one. I've even tried to do the `UIImage` saving code in a button action but still didn't work.

```
-(void)CreateTheImage{

    UIImage * img = [UIImage imageNamed:@"SquareBackground.jpg"];

    UIGraphicsBeginImageContext(_imgView.bounds.size);
    int Counter = 0;

    for (UIView * view in [_imgView subviews]){
        [view removeFromSuperview];
    }

    NSString *txt1 = @"Test";
    NSString *txt2 = @"Worked Well";

    [array addObject:txt1];
    [array addObject:txt2];
    UILabel *lbl = [[UILabel alloc]init];

    NSLog(@"%i",[array count]);
    NSLog(@"Before the loop");

    for (int x = 0; x < [array count]; x++) {

        NSLog(@"Entered the loop");
        NSLog(@"x = %i",x);

        lbl.text = [array objectAtIndex:x];
        NSLog(@"lbl.text = %@",[array objectAtIndex:x]);

        lbl.textAlignment = NSTextAlignmentCenter;
        [lbl setBackgroundColor:[UIColor clearColor]];
        lbl.font = [UIFont boldSystemFontOfSize:16];
        [lbl setFrame:CGRectMake(20,112.5, 260, 75)];

        [_imgView addSubview:lbl];
        [_imgView bringSubviewToFront:lbl];
        [_imgView setImage:img];
        [_imgView.layer renderInContext:UIGraphicsGetCurrentContext()];

        Counter = x+1;
        NSLog(@"counter = %i",Counter);
        switch (Counter) {
            case 1:

                NSLog(@"swintch case 1");
                newImage1 = UIGraphicsGetImageFromCurrentImageContext();

                break;

            case 2:

                NSLog(@"swintch case 2");
                newImage2 = UIGraphicsGetImageFromCurrentImageContext();

                break;

        default:
            break;
        }

        NSLog(@"after switch");

        UIGraphicsEndImageContext();

    }

    //To save the picture in the album
    UIImageWriteToSavedPhotosAlbum(newImage1, nil, nil, nil);
    UIImageWriteToSavedPhotosAlbum(newImage2, nil, nil, nil);

    NSLog(@"After the loop");

}

```

Also when I run this method on my iPhone it gives me a warning which is

> 
> CreatingVideo[334] : CGContextSaveGState: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update.
> 
> 
>