如何在 iPhone 中以编程方式设置锁屏、壁纸和铃声? [英] How to set lock screen , wallpaper and Ringtone programmatically in iPhone?

查看:48
本文介绍了如何在 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来改变铃声,特别是ringtone键.

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 中以编程方式设置锁屏、壁纸和铃声?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆