在 iPhone 中,我们可以通过编程方式设置锁屏、壁纸和铃声吗?
如果是,请告诉我如何设置它们?
最佳答案
这一切都可以轻松完成,但会被 Apple 拒绝。
可以通过更改 com.apple.SpringBoard.plist
来更改铃声,特别是 ringtone
键。
以下代码可用于读取自定义铃声(由iTunes同步)的实际铃声标题。
NSMutableDictionary *custDict = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/private/var/mobile/Media/iTunes_Control/iTunes/Ringtones.plist"];
NSMutableDictionary *dictionary = [custDict objectForKey:@"Ringtones"];
NSArray *keys = [dictionary allKeys];
id key = [keys objectAtIndex:indexPath.row];
NSMutableDictionary *customRingtone = [dictionary objectForKey:key];
NSString *name = [customRingtone objectForKey:@"Name"];
cell.textLabel.text = name;
可以在以下位置覆盖壁纸:
NSString *homePath1 = @"/private/var/mobile/Library/SpringBoard/HomeBackground.jpg";
NSString *homePath2 = @"/private/var/mobile/Library/SpringBoard/HomeBackgroundPortrait.jpg";
NSString *lockPath1 = @"/private/var/mobile/Library/SpringBoard/LockBackground.jpg";
NSString *lockPath2 = @"/private/var/mobile/Library/SpringBoard/LockBackgroundPortrait.jpg";
我的一个 Cydia 应用程序中使用了这些示例。它们实际上并没有更多,但这些应该会让您朝着正确的方向前进。
关于ios - 如何在 iPhone 中以编程方式设置锁屏、墙纸和铃声?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4476777/