最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

iOS8調(diào)用相機(jī)報(bào)警告Snapshotting a view的解決方法

 更新時(shí)間:2016年11月04日 15:00:34   作者:沸騰的淚水05314  
這篇文章主要介紹了iOS8調(diào)用相機(jī)報(bào)警告Snapshotting a view……的解決方法 ,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

因?yàn)槲疫@也報(bào)了這個(gè)警告,所以把解決方法寫到這個(gè)地方看是否其他人用的到,具體解決方法:

錯(cuò)誤代碼:Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

問(wèn)題分析:iOS8在調(diào)用系統(tǒng)相機(jī)拍照時(shí),會(huì)有一兩秒的停頓,然后再?gòu)棾鯱IImagePickConroller,IOS7是沒(méi)有這個(gè)問(wèn)題的,在百度找了無(wú)數(shù)遍都沒(méi)能解決這個(gè)問(wèn)題,有說(shuō)要將imagePickController設(shè)置為全局變量,有說(shuō)要延時(shí)0.5秒再presentViewController的,各顯神通,但很遺憾的都沒(méi)能解決這個(gè)問(wèn)題,今天特意單獨(dú)寫個(gè)Demo來(lái)研究此問(wèn)題,終于取得了突破性的進(jìn)展!

其實(shí)根本原因不在于系統(tǒng)拍照控制器上面,而是執(zhí)行presentViewController這個(gè)動(dòng)作本身!我們可以查看下UIViewController這個(gè)類,他有一個(gè)屬性:

@property(nonatomic,assign)
 UIModalPresentationStyle modalPresentationStyle NS_AVAILABLE_IOS(3_2);

這是一個(gè)枚舉值,在iOS7的SDK中,定義如下:

typedefNS_ENUM(NSInteger,
 UIModalPresentationStyle) {

  UIModalPresentationFullScreen
 = 0,

#if
 __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2

  UIModalPresentationPageSheet,

  UIModalPresentationFormSheet,

  UIModalPresentationCurrentContext,

#endif

#if
 __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0

  UIModalPresentationCustom,

  UIModalPresentationNone
 = -1,    

#endif    

};

在iOS8的SDK中定義如下:

typedefNS_ENUM(NSInteger,
 UIModalPresentationStyle) {

    UIModalPresentationFullScreen
 = 0,

    UIModalPresentationPageSheetNS_ENUM_AVAILABLE_IOS(3_2),

    UIModalPresentationFormSheetNS_ENUM_AVAILABLE_IOS(3_2),

    UIModalPresentationCurrentContextNS_ENUM_AVAILABLE_IOS(3_2),

    UIModalPresentationCustomNS_ENUM_AVAILABLE_IOS(7_0),

    UIModalPresentationOverFullScreenNS_ENUM_AVAILABLE_IOS(8_0),

    UIModalPresentationOverCurrentContextNS_ENUM_AVAILABLE_IOS(8_0),

    UIModalPresentationPopoverNS_ENUM_AVAILABLE_IOS(8_0),

    UIModalPresentationNoneNS_ENUM_AVAILABLE_IOS(7_0)
 = -1,     

};

解決問(wèn)題的關(guān)鍵部分來(lái)了,IOS8多了一個(gè)樣式UIModalPresentationOverCurrentContext,IOS8中presentViewController時(shí)請(qǐng)將控制器的modalPresentationStyle設(shè)置為UIModalPresentationOverCurrentContext,問(wèn)題解決??!

if([[[UIDevice
 currentDevice] systemVersion] floatValue]>=8.0) {

  self.modalPresentationStyle=UIModalPresentationOverCurrentContext;

}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

凌源市| 且末县| 思南县| 东阳市| 丁青县| 巴马| 靖宇县| 安溪县| 从化市| 洛隆县| 泌阳县| 彰化市| 石河子市| 石嘴山市| 定襄县| 留坝县| 达日县| 卢氏县| 且末县| 靖宇县| 永川市| 新泰市| 临城县| 唐河县| 三亚市| 辉南县| 九江县| 汝城县| 库尔勒市| 修武县| 安岳县| 孟连| 乌拉特后旗| 拉孜县| 景洪市| 广平县| 乡宁县| 博乐市| 靖西县| 麻城市| 水富县|