//获取全局的Delegate对象,这样我们可以调用这个对象里的方法和变量

[[UIApplication sharedApplication] delegate];

//获得程序的主Bundle

NSBundle *bundle = [NSBundle mainBundle];

/*

在程序中播放声音

1.添加AudioToolbox框架

*/

NSString *path = [bundle pathForResource:@"soundFileName" ofType:@"wav"];

SystemSoundID soundId;

AudioServicesCreateSystemSoundID((__bridge CFURLRef)([NSURL URLWithString:path]), &soundId);

AudioServicesPlayAlertSound(soundId);

//捕捉程序关闭或者进入后台事件

UIApplication *application = [UIApplication sharedApplication];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillResignActive:) name:UIApplicationWillResignActiveNotification object:application];

}

- (void)applicationWillResignActive:(NSNotification *)noti{

}

#pragma mark -- 获取截屏

- (UIImage *)getScreenShot{

UIGraphicsBeginImageContext(self.view.bounds.size);

[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return image;

}

最新文章

  1. 对copy、mutableCopy理解
  2. mybatis的mapper中,实体非空检验问题
  3. Net操作Excel(终极方法NPOI)
  4. qt-5.6.0 移植之qt文件系统的建立
  5. 编写高质量代码--改善python程序的建议(六)
  6. PHP中该怎样防止SQL注入?
  7. 3行3列表格 table实现,div+css实现
  8. MySQL用命令行复制表的方法
  9. c# datagridviewcomboboxcell值无效的解决办法
  10. html-----vedio标签(HTML5新标签VIDEO在IOS上默认全屏播放)
  11. 关于div+css排版布局中需注意的细节问题
  12. 使用swiper简单的h5下滑翻页效果,
  13. 二分查找、two points、排序
  14. php foreach
  15. js call 和 apply方法记录
  16. Centos6.6下编译安装Apache2.2.31
  17. php与redis使用经验分享 (转载)
  18. 8 -- 深入使用Spring -- 7...3 让Spring管理控制器
  19. java中调用groovy
  20. sqlserver字符串多行合并为一行

热门文章

  1. 20145224&20145238 《信息安全系统设计基础》 第五次实验
  2. Scrapy--1安装和运行
  3. 用margin还是padding
  4. 为了防止采集,把文章中出现的URL链接随机大小写(PHP实现)
  5. sql server 维护计划与作业关系区别
  6. Windbg使用简明指南
  7. ubuntu 14.04 64位安装iNodeClient
  8. 未找到导入的项目,请确认 <Import> 声明中的路径正确
  9. java基本输入输出练习
  10. 解析Hibernate中的持久化—ORM(转载)