Open thefenix1 opened 9 years ago
Do anyone could help me with this if I provide more details? Not sure if my quesiton is not clear enough , Thanks for the great work with this component.
Unfortunately I didn't find any way to make this work so I had to change component code. If this is the correct way to do it, would be great to see it integrated to the repository. There may be better ways though.
Changes on "SWRevealViewController.m"
-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (void)viewWillDisappear:(BOOL)animated
{
[[UIApplication sharedApplication] endReceivingRemoteControlEvents];
[self resignFirstResponder];
[super viewWillDisappear:animated];
}
- (void)remoteControlReceivedWithEvent:(UIEvent *)event {
switch (event.subtype) {
case UIEventSubtypeRemoteControlPlay:
[[NSNotificationCenter defaultCenter] postNotificationName:kSWRemoteControlPlay object:self];
break;
case UIEventSubtypeRemoteControlPause:
[[NSNotificationCenter defaultCenter] postNotificationName:kSWRemoteControlPause object:self];
break;
default:
break;
}
}
constants definition
NSString *const kSWRemoteControlPause = @"SWRemoteControlPause";
NSString *const kSWRemoteControlPlay = @"SWRemoteControlPlay";
Changes on "SWRevealViewController.h"
extern NSString *const kSWRemoteControlPause;
extern NSString *const kSWRemoteControlPlay;
Since I added this component to my project, lock screen media controls quit working. Method "remoteControlReceivedWithEvent" is not called anymore on my view controller. I'd say it's not surprising since "SWRevealViewController" becomes root controller.
I'm not sure how to make this work again. Maybe is something easy and I'm not seeing it. Could you help me with this?
Thanks