Created
December 6, 2014 09:23
-
-
Save torcelly/8cd8f47aaf7a9f0b1a28 to your computer and use it in GitHub Desktop.
Setup iOS Lock Screen (MPMedia)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) setupInfoLockScreen | |
{ | |
[[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; | |
// Info | |
NSString *leftSide = @"Left Side"; | |
NSString *rightSide = @"Right Side"; | |
NSString *titleSide = @"Title"; | |
UIImage *image = ...; | |
MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc]initWithImage:image]; | |
[nowPlaying setValue:leftSide forKey:MPMediaItemPropertyArtist]; | |
[nowPlaying setValue:rightSide forKey:MPMediaItemPropertyAlbumTitle]; | |
[nowPlaying setValue:titleSide forKey:MPMediaItemPropertyTitle] | |
[nowPlaying setValue:artwork forKey:MPMediaItemPropertyArtwork]; | |
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:nowPlaying]; | |
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:nowPlaying]; | |
}// setupInfoLockScreen | |
- (void) cleanLockScreen | |
{ | |
[[UIApplication sharedApplication]endReceivingRemoteControlEvents]; | |
[[MPNowPlayingInfoCenter defaultCenter]setNowPlayingInfo:nil]; | |
}// cleanLockScreen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment