In Appdelegate.h
I imported the playerviewcontroller
in both Appdelegate.h
and Appdelegate.m
files.
@class PlayerViewController;
@property(nonatomic)float volumeDelegate;
In Appdelegate.m
@synthesize volumeDelegate;
- (void)volumeChanged:(NSNotification *)notification
{
volumeDelegate =1.0
PlayerViewController *volumeObject=[[PlayerViewController alloc]init];
[volumeObject setVolumeForAVAudioPlayer];
}
In Playerviewcontroller.h
-(void)setVolumeForAVAudioPlayer;
In Playerviewcontroller.m
@interface PlayerViewController ()
{
AppDelegate *appdelegate;
}
-(void)viewDidLoad
{
appdelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
}
-(void)setVolumeForAVAudioPlayer
{
[appdelegate.sharedplayer setVolume:appdelegate.volumeDelegate];
NSLog(@"System Volume in player view: %f",appdelegate.volumeDelegate);
}
When i run this I get volumeDelegate
value as Zero as below.
System Volume in player view:0.000000000
What is the Mistake I'm making here