本文介绍了如何在iPhone中以编程方式设置锁屏,壁纸和铃声?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iPhone中,我们可以通过编程方式设置锁定屏幕,壁纸和铃声吗?

In iPhone can we set the lock screen, wallpaper and ringtone programmatically?

如果,请告诉我如何设置他们?

If Yes, then please let me know how to set them?

推荐答案

这一切都可以轻松完成,但Apple会拒绝。

This can all be done easily, but will be rejected by Apple.

可以通过更改 com.apple.SpringBoard.plist 来更改铃声,特别是铃声密钥。

The ringtone can be changed by altering com.apple.SpringBoard.plist, specifically the ringtone key.

以下代码可用于读取自定义铃声的实际铃声标题(由iTunes同步)。

The following code can be used to read the actual ringtone title of custom ringtones (synced by 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;

可以在以下位置覆盖壁纸:

The Wallpapers can be overwritten at:

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应用程序中。对他们来说并不多,但这些应该让你朝着正确的方向前进。

These examples were used in one of my Cydia apps. Theres not really much more to them, but these should get you going in the right direction.

这篇关于如何在iPhone中以编程方式设置锁屏,壁纸和铃声?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 08:25