Hey guys!
I want to change the alpha of a UIButton which sounds actually pretty simple. However, I want to change that alpha from a different class(ViewControllerB.m/.h). I got a class called "ViewController.h/.m" and from this class I call a view which appears on the ViewController like a popup. Now I got a UIButton which displays the popup, when it's touched. If the button was touched its alpha will change to "0.0" and the popup will be shown. I got the code from the popup in another class and I want to change the alpha of the button to "1.0" if the pupup was dismissed. I already got a method, that is called when the popup was dismissed. I tried everything, but it didn't worked so far. Maybe because I'm a beginner at iOS ^^.
I hope you understood what I am trying to say. I will leave the code as it is (clean) to do not confuse you with the ways I tried before.
Here you got the codes of my classes:
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
//....
    IBOutlet UIButton *myBtn;
//...
}
- (IBAction)OpenPopUp:(id)sender;
Now in my ViewController.m:
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
//...viewDidLoad....everything else
- (IBAction)OpenPopUp:(id)sender {
 [UIView animateWithDuration: 1.0
                     animations:^{
    myBtn.alpha = 0.0;
                     }];
}
@end
In my ViewControllerB.h:
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
@interface ViewControllerB : UIViewController {
//...some unneccesary outlets
}
//Displaying popup.....
- (void)presentInParentViewController:(UIViewController *)parentViewController;
@end
ViewControllerB.m :
#import "ViewControllerB.h"
@interface ViewControllerB () 
@end
@implementation
//...ViewDidload...and more
- (IBAction)close:(id)sender {
    //The close button
    [self dismissFromParentViewController];
}
- (void)dismissFromParentViewController {
    //Removes the nutrition view from the superview
    [self willMoveToParentViewController:nil];
    //Removes the view with or without animation
    if (!self.shouldAnimateOnDisappear) {
        [self.view removeFromSuperview];
        [backgroundGradientView removeFromSuperview];
        [self removeFromParentViewController];
        return;
    }
    else {
        [UIView animateWithDuration:0.4 animations:^ {
            CGRect rect = self.view.bounds;
            rect.origin.y += rect.size.height;
            self.view.frame = rect;
            backgroundGradientView.alpha = 0.0f;
        }
                         completion:^(BOOL finished) {
                             [self.view removeFromSuperview];
                             [backgroundGradientView removeFromSuperview];
                             [self removeFromParentViewController];
                         }];
    }
//THE PLACE I WANT TO CHANGE THE ALPHA BACK!
}
I really would appreciate anyones help and if you can please show it me on code examples.
Thank you,
Noah
NOTE: I already looked up this posts but tried unsuccsessfully.
 
     
    