UILocalNotification 使用Documents目录的声音文件和图片文件
2012-05-03 19:13
239 查看
NSString *strMusic =
@"../Documents/heartbeats.m4a"; //声音文件不要超过30秒
NSString *strImage =
@"../Documents/imm.png";
//如果用下面注释的方式访问Documents的声音和图片,不能实现想要的效果,必须用上面的方式
//NSArray *arrPath =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
//NSString *strDoc = [arrPath
objectAtIndex:0];
//NSString *strImage = [strDoc
stringByAppendingPathComponent:@"imm.png"];
//NSString *strMusic = [strDoc
stringByAppendingPathComponent:@"heartbeats.m4a"];
UILocalNotification *notification=[[UILocalNotification
alloc]
init];
notification.fireDate=[NSDate
dateWithTimeIntervalSinceNow:10];
notification.timeZone=[NSTimeZone
defaultTimeZone];
notification.repeatInterval =
NSSecondCalendarUnit;
notification.alertAction = [NSString
stringWithFormat:@"
显示闹钟"];
notification.alertBody= [NSString
stringWithFormat:@"我的闹钟"];
notification.soundName = strMusic;
notification.alertLaunchImage = strImage;
[[UIApplication
sharedApplication] scheduleLocalNotification:notification];
在模拟器和iphone4(5.1系统)测试通过,不知道低版本是否支持!还有不知道能否通过苹果审核?
@"../Documents/heartbeats.m4a"; //声音文件不要超过30秒
NSString *strImage =
@"../Documents/imm.png";
//如果用下面注释的方式访问Documents的声音和图片,不能实现想要的效果,必须用上面的方式
//NSArray *arrPath =
NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
//NSString *strDoc = [arrPath
objectAtIndex:0];
//NSString *strImage = [strDoc
stringByAppendingPathComponent:@"imm.png"];
//NSString *strMusic = [strDoc
stringByAppendingPathComponent:@"heartbeats.m4a"];
UILocalNotification *notification=[[UILocalNotification
alloc]
init];
notification.fireDate=[NSDate
dateWithTimeIntervalSinceNow:10];
notification.timeZone=[NSTimeZone
defaultTimeZone];
notification.repeatInterval =
NSSecondCalendarUnit;
notification.alertAction = [NSString
stringWithFormat:@"
显示闹钟"];
notification.alertBody= [NSString
stringWithFormat:@"我的闹钟"];
notification.soundName = strMusic;
notification.alertLaunchImage = strImage;
[[UIApplication
sharedApplication] scheduleLocalNotification:notification];
在模拟器和iphone4(5.1系统)测试通过,不知道低版本是否支持!还有不知道能否通过苹果审核?
相关文章推荐
- UILocalNotification本地通知的使用方法
- 如何使用asp.net中的控件将一个图片文件从一个目录传到另外一个目录下?
- 使用本地通知UILocalNotification实现简易闹钟
- [How to] UILocalNotification 的使用
- 使用UILocalNotification 添加本地通知事件
- UILocalNotification的使用
- iOS通过设置info.plist参数使用iTunes导入导出Documents目录下的文件
- cocos2dx xcode使用其他工程的class文件和带子目录的图片资源文件
- UILocalNotification的使用
- UILocalNotification的使用方法
- iPhone开发 UILocalNotification的使用
- 【转载】iOS下的UILocalNotification的使用
- iOS下的UILocalNotification的使用
- iPhone开发 UILocalNotification的使用
- iPhone开发 UILocalNotification的使用
- UILocalNotification的使用
- iOS8 UILocalNotification 和 UIRemoteNotification 使用注意 草稿,正在整理中。。。。
- UILocalNotification 开发过程中的使用
- UILocalNotification的使用
- UILocalNotification的使用