UIAccessibility是在UIKit里的一個(gè)非正式協(xié)議扯再,提供關(guān)于UI元素的輔助功能离熏。這個(gè)信息能夠通過(guò)VoiceOver和其他輔助科技幫助肢體障礙者用戶與你的用戶進(jìn)行交互佳谦。
UIAccessibility所有屬性的列表:
//控件的識(shí)別符,默認(rèn)值為nil
accessibilityLabel
//操作后的提示
//是對(duì)控件執(zhí)行操作后結(jié)果的簡(jiǎn)單描述滋戳,而不識(shí)別控件和操作钻蔑。
//例如,包含電子郵件消息的表行的提示可能是“選擇消息”奸鸯,但不是“點(diǎn)擊此行以選擇消息”咪笑。
accessibilityHint:
//控件具體值
//當(dāng)輔助功能元素具有靜態(tài)標(biāo)簽和動(dòng)態(tài)值, accessibilityValue為動(dòng)態(tài)值
//如textfield控件的標(biāo)示屬性為accessibilityLabel,對(duì)應(yīng)輸入框的文本值屬性為accessibilityValue
accessibilityValue
//控件語(yǔ)言屬性
accessibilityLanguage
//控件的特性
//控件的種類信息娄涩,使用了UIAccessibiltyTraits為值的位掩碼窗怒,這個(gè)屬性可以由文檔里指定好幾個(gè)屬性結(jié)合而成。如自定義按鈕顯示一張圖片,點(diǎn)擊播放聲音扬虚,則控件的特征為“按鈕”努隙,“圖片”,“播放聲音”辜昵。
accessibilityTraits
//控件的位置信息
//具體指的是在屏幕上的大小和位置信息
accessibilityFrame
//控件激活點(diǎn)
//默認(rèn)為accessibilityFrame中心點(diǎn)荸镊,但也有列外如長(zhǎng)按刪除應(yīng)用,控件激活點(diǎn)為圖標(biāo)左上角的圓圈叉
accessibilityActivationPoint
//控件隱藏
//使用此屬性來(lái)隱藏控件堪置。在這種情況下躬存,隱藏的控件可能在屏幕上可見(jiàn),但它們無(wú)法進(jìn)行操作晋柱。
accessibilityElementsHidden
//控件的組屬性
//默認(rèn)值為no优构,若為yes VoiceOver將忽略該該控件,且包括該控件所在視圖中的其他控件
accessibilityViewIsModal
控件獲取
等待控件顯示(一)
相對(duì)通用的方法雁竞,衍生出三種api等待目標(biāo)控件出現(xiàn)钦椭,返回目標(biāo)的UIView對(duì)象
定位目標(biāo)對(duì)象參數(shù):
label(accessibilityLabel):控件的輔助功能標(biāo)示
traits(accessibilityTraits):控件的輔助功能特性
value(accessibilityValue):控件的文本值,如textfield文本輸入滿足一定條件才符合條件
返回參數(shù):
UIView:控件對(duì)象指針
- (UIView *)waitForViewWithAccessibilityLabel:(NSString *)label;
- (UIView *)waitForViewWithAccessibilityLabel:(NSString *)label traits:(UIAccessibilityTraits)traits;
- (UIView *)waitForViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits;
等待控件顯示(二)
與等待控件顯示(一)基本一致碑诉,區(qū)別在于添加“可點(diǎn)擊”的約束
- (UIView *)waitForTappableViewWithAccessibilityLabel:(NSString *)label;
- (UIView *)waitForTappableViewWithAccessibilityLabel:(NSString *)label traits:(UIAccessibilityTraits)traits;
- (UIView *)waitForTappableViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits;
等待控件顯示(三)
通過(guò)傳址彪腔,將符合條件的控件對(duì)象進(jìn)行賦值。
參數(shù):
賦值參數(shù)
element(UIAccessibilityElement **):傳址进栽,將符合條件的對(duì)象存儲(chǔ)德挣,類型為UIAccessibilityElement
view(out UIView **):傳址,將符合條件的對(duì)象存儲(chǔ)快毛,類型為UIView
條件參數(shù)
label(accessibilityLabel):控件的輔助功能標(biāo)示
fromView(UIView):遍歷符合條件的起始視圖
traits(UIAccessibilityTraits):控件的輔助功能特性
mustBeTappable(BOOL):是否可以點(diǎn)擊
- (void)waitForAccessibilityElement:(UIAccessibilityElement **)element view:(out UIView **)view withLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits tappable:(BOOL)mustBeTappable;
- (void)waitForAccessibilityElement:(UIAccessibilityElement **)element view:(out UIView **)view withLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits fromRootView:(UIView *)fromView tappable:(BOOL)mustBeTappable;
等待控件顯示(四)
利用邏輯約束(NSPredicate)等待符合條件的控件格嗅,與等待控件顯示(三)類型,差別是使用邏輯約束尋找目標(biāo)控件
參數(shù):
賦值參數(shù)
element(UIAccessibilityElement **):傳址唠帝,將符合條件的對(duì)象存儲(chǔ)屯掖,類型為UIAccessibilityElement
view(out UIView **):傳址,將符合條件的對(duì)象存儲(chǔ)襟衰,類型為UIView
條件參數(shù)
predicate(NSPredicate *):邏輯約束
identifier(NSString *):邏輯約束NSString表達(dá)贴铜,函數(shù)內(nèi)部會(huì)將其轉(zhuǎn)為為NSPredicate對(duì)象
mustBeTappable(BOOL):是否可點(diǎn)擊作為約束條件
- (void)waitForAccessibilityElement:(UIAccessibilityElement **)element view:(out UIView **)view withElementMatchingPredicate:(NSPredicate *)predicate tappable:(BOOL)mustBeTappable;
- (void)waitForAccessibilityElement:(UIAccessibilityElement **)element view:(out UIView **)view withIdentifier:(NSString *)identifier tappable:(BOOL)mustBeTappable;
- (void)waitForAccessibilityElement:(UIAccessibilityElement **)element view:(out UIView **)view withIdentifier:(NSString *)identifier fromRootView:(UIView *)fromView tappable:(BOOL)mustBeTappable;
等待控件消失
與等待控件顯示API的傳參一致,差別是等待控件消失
- (void)waitForAbsenceOfViewWithAccessibilityLabel:(NSString *)label;
- (void)waitForAbsenceOfViewWithAccessibilityLabel:(NSString *)label traits:(UIAccessibilityTraits)traits;
- (void)waitForAbsenceOfViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits;
- (void)waitForAbsenceOfViewWithElementMatchingPredicate:(NSPredicate *)predicate;
手勢(shì)操作
點(diǎn)擊
//方式一:
//通過(guò)accessibilityLabel尋找并點(diǎn)擊目標(biāo)控件
//steup1.等待符合條件的控件(accessibilityLabel標(biāo)示瀑晒,accessibilityTraits特性绍坝,accessibilityValue文本值)
//steup2.點(diǎn)擊符合條件的控件
- (void)tapViewWithAccessibilityLabel:(NSString *)label;
- (void)tapViewWithAccessibilityLabel:(NSString *)label traits:(UIAccessibilityTraits)traits;
- (void)tapViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits;
//方式二:
//點(diǎn)擊指定視圖view中的UIAccessibilityElement對(duì)象
element(UIAccessibilityElement *):UIAccessibilityElement對(duì)象
view(UIView *):視圖
- (void)tapAccessibilityElement:(UIAccessibilityElement *)element inView:(UIView *)view;
//方式三:點(diǎn)擊屏幕某個(gè)坐標(biāo)
- (void)tapScreenAtPoint:(CGPoint)screenPoint;
長(zhǎng)按
//方式一:
//通過(guò)accessibilityLabel尋找并點(diǎn)擊目標(biāo)控件
//steup1.等待符合條件的控件(accessibilityLabel標(biāo)示,accessibilityTraits特性苔悦,accessibilityValue文本值)
//steup2.長(zhǎng)按符合條件的控件轩褐,長(zhǎng)按時(shí)間為duration
- (void)longPressViewWithAccessibilityLabel:(NSString *)label duration:(NSTimeInterval)duration;
- (void)longPressViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value duration:(NSTimeInterval)duration;
- (void)longPressViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits duration:(NSTimeInterval)duration;
//方式二:
//長(zhǎng)按指定視圖view中的UIAccessibilityElement對(duì)象,長(zhǎng)按時(shí)間為duration
- (void)longPressAccessibilityElement:(UIAccessibilityElement *)element inView:(UIView *)view duration:(NSTimeInterval)duration;
滑動(dòng)
//方式一:
//根據(jù)accessibiltyLabel尋找符合條件的控件间坐,并滑動(dòng)
//horizontalFraction:水平滑動(dòng)距離
//verticalFraction:垂直滑動(dòng)距離
- (void)scrollViewWithAccessibilityLabel:(NSString *)label byFractionOfSizeHorizontal:(CGFloat)horizontalFraction vertical:(CGFloat)verticalFraction
//方式二:
//根據(jù)邏輯約束(identifier)尋找符合條件的控件灾挨,并滑動(dòng)
//horizontalFraction:水平滑動(dòng)距離
//verticalFraction:垂直滑動(dòng)距離
- (void)scrollViewWithAccessibilityIdentifier:(NSString *)identifier byFractionOfSizeHorizontal:(CGFloat)horizontalFraction vertical:(CGFloat)verticalFraction
//方式三:
//滑動(dòng)指定視圖view中的UIAccessibilityElement對(duì)象
//horizontalFraction:水平滑動(dòng)距離
//verticalFraction:垂直滑動(dòng)距離
- (void)scrollAccessibilityElement:(UIAccessibilityElement *)element inView:(UIView *)viewToScroll byFractionOfSizeHorizontal:(CGFloat)horizontalFraction vertical:(CGFloat)verticalFraction;
輕掃
//方式一
//steup1.尋找符合條件的目標(biāo)控件(accessibilityLabel標(biāo)示邑退,accessibilityTraits特性,accessibilityValue文本值)
//steup2.根據(jù)設(shè)定的方向值劳澄,輕掃目標(biāo)控件
- (void)swipeViewWithAccessibilityLabel:(NSString *)label inDirection:(KIFSwipeDirection)direction;
- (void)swipeViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value inDirection:(KIFSwipeDirection)direction;
- (void)swipeViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits inDirection:(KIFSwipeDirection)direction;
//方式二
//輕掃指定視圖view中的UIAccessibilityElement對(duì)象地技,方向有direction指定
- (void)swipeAccessibilityElement:(UIAccessibilityElement *)element inView:(UIView *)viewToSwipe inDirection:(KIFSwipeDirection)direction;
下拉刷新
//方式一
//steup1.尋找符合條件的目標(biāo)控件(accessibilityLabel標(biāo)示,accessibilityValue文本值)
//steup2.下拉目標(biāo)控件秒拔,下拉持續(xù)時(shí)間由pullDownDuration設(shè)定
- (void)pullToRefreshViewWithAccessibilityLabel:(NSString *)label pullDownDuration:(KIFPullToRefreshTiming) pullDownDuration;
- (void)pullToRefreshViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value;
//方式二
//下拉刷新指定視圖view中的UIAccessibilityElement對(duì)象莫矗,下拉持續(xù)時(shí)間由pullDownDuration設(shè)定
- (void)pullToRefreshAccessibilityElement:(UIAccessibilityElement *)element inView:(UIView *)viewToSwipe pullDownDuration:(KIFPullToRefreshTiming) pullDownDuration;
特殊控件操作
文本輸入操作
//方式一
//對(duì)第一響應(yīng)的控件輸入文本,對(duì)于UIWebView/無(wú)輔助功能標(biāo)示的控件較為有用
//對(duì)默認(rèn)第一響應(yīng)進(jìn)行輸入
//text=@“\b”表明刪除一個(gè)字符砂缩,text=@“\b\b”表示刪除兩個(gè)字符作谚,以此類推
- (void)enterTextIntoCurrentFirstResponder:(NSString *)text;
//判斷fallbackView是否是可輸入控件(UITextField,UITextView庵芭,UISearchBar)妹懒,若是則輸入文本
//方式二
//對(duì)指定視圖中的UIAccessibilityElement輸入文本,element和view用于定位點(diǎn)擊操作双吆,使得view作為第一響應(yīng)可以輸入文本
//text:輸入的文本
//expectedResult:函數(shù)內(nèi)部會(huì)拿該值去檢測(cè)完成輸入后的文本是否完全匹配expectedResult值
//類似斷言眨唬,即調(diào)用- (void)expectView:(UIView *)view toContainText:(NSString *)expectedResult方法
- (void)enterText:(NSString *)text intoElement:(UIAccessibilityElement *)element inView:(UIView *)view expectedResult:(NSString *)expectedResult;
- (void)expectView:(UIView *)view toContainText:(NSString *)expectedResult;
//方式三
//與方式二類事,不同在于尋找控件的條件不同(accessibilityLabel好乐,accessibilityTraits)
- (void)enterText:(NSString *)text intoViewWithAccessibilityLabel:(NSString *)label;
- (void)enterText:(NSString *)text intoViewWithAccessibilityLabel:(NSString *)label traits:(UIAccessibilityTraits)traits expectedResult:(NSString *)expectedResult;
文案刪除操作
//方式一
//清除第一響應(yīng)的文本
- (void)clearTextFromFirstResponder;
//方式二
//清除符合條件的控件文案
- (void)clearTextFromViewWithAccessibilityLabel:(NSString *)label;
- (void)clearTextFromViewWithAccessibilityLabel:(NSString *)label traits:(UIAccessibilityTraits)traits;
//方式三
//與方式二一致匾竿,尋找條件不一致
- (void)clearTextFromElement:(UIAccessibilityElement *)element inView:(UIView *)view;
//文案刪除后再輸入指定文案
- (void)clearTextFromAndThenEnterTextIntoCurrentFirstResponder:(NSString *)text;
- (void)clearTextFromAndThenEnterText:(NSString *)text intoViewWithAccessibilityLabel:(NSString *)label;
- (void)clearTextFromAndThenEnterText:(NSString *)text intoViewWithAccessibilityLabel:(NSString *)label traits:(UIAccessibilityTraits)traits expectedResult:(NSString *)expectedResult;
UITableView
//點(diǎn)擊
//TableView中的指定cell
//參數(shù):
//indexPath(NSIndexPath *):cell的索引值,-1為最后一個(gè)cell
//搜索參數(shù):AccessibilityLabel(輔助控件標(biāo)示)/AccessibilityIdentifier(邏輯約束)/UITableView(控件指針)
- (void)tapRowInTableViewWithAccessibilityLabel:(NSString *)tableViewLabel atIndexPath:(NSIndexPath *)indexPath
- (void)tapRowAtIndexPath:(NSIndexPath *)indexPath inTableViewWithAccessibilityIdentifier:(NSString *)identifier
- (void)tapRowAtIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView;
//等待
//TableView中的指定cell出現(xiàn)
//參數(shù)
//indexPath(NSIndexPath *):cell的索引值蔚万,-1為最后一個(gè)cell
//atPosition(UITableViewScrollPosition):指定cell移動(dòng)到的位置岭妖,如TableView顯示的底部,中部反璃,頂部
//搜索條件:AccessibilityIdentifier(邏輯約束)/UITableView(控件指針)
- (UITableViewCell *)waitForCellAtIndexPath:(NSIndexPath *)indexPath inTableViewWithAccessibilityIdentifier:(NSString *)identifier;
- (UITableViewCell *)waitForCellAtIndexPath:(NSIndexPath *)indexPath inTableViewWithAccessibilityIdentifier:(NSString *)identifier atPosition:(UITableViewScrollPosition)position;
- (UITableViewCell *)waitForCellAtIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView;
- (UITableViewCell *)waitForCellAtIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView atPosition:(UITableViewScrollPosition)position;
//編輯模式下昵慌,移動(dòng)table cell
//TableView的cell
//參數(shù):
//sourceIndexPath:滑動(dòng)的起始索引
//destinationIndexPath:滑動(dòng)的終止索引
//搜索條件:AccessibilityIdentifier(邏輯約束)/UITableView(控件指針)
- (void)moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath inTableViewWithAccessibilityIdentifier:(NSString *)identifier;
- (void)moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath inTableView:(UITableView *)tableView;
//其他
//向某個(gè)方向拖拽指定cell
- (void)swipeRowAtIndexPath:(NSIndexPath *)indexPath inTableView:(UITableView *)tableView inDirection:(KIFSwipeDirection)direction;
//等待指定cell出現(xiàn)刪除狀態(tài)
//cell(UITableViewCell*):cell對(duì)象指針
- (void)waitForDeleteStateForCell:(UITableViewCell*)cell;
- (void)waitForDeleteStateForCellAtIndexPath:(NSIndexPath*)indexPath inTableView:(UITableView*)tableView;
CollectionView
//與TableView的使用基本一致
- (void)tapItemAtIndexPath:(NSIndexPath *)indexPath inCollectionViewWithAccessibilityIdentifier:(NSString *)identifier;
- (void)tapItemAtIndexPath:(NSIndexPath *)indexPath inCollectionView:(UICollectionView *)collectionView;
- (UICollectionViewCell *)waitForCellAtIndexPath:(NSIndexPath *)indexPath inCollectionView:(UICollectionView *)collectionView;
- (UICollectionViewCell *)waitForCellAtIndexPath:(NSIndexPath *)indexPath inCollectionViewWithAccessibilityIdentifier:(NSString *)identifier;
UIPickerView
//選擇對(duì)應(yīng)UIPickerView的單元
//參數(shù):
//title(NSString *):?jiǎn)卧臉?biāo)題
//component:UIPickerView對(duì)應(yīng)的列
//searchOrder(KIFPickerSearchOrder):滑動(dòng)UIPickerView單元的順序(4種,具體參考源碼)
- (void)selectPickerViewRowWithTitle:(NSString *)title;
- (void)selectPickerViewRowWithTitle:(NSString *)title inComponent:(NSInteger)component;
- (void)selectPickerViewRowWithTitle:(NSString *)title inComponent:(NSInteger)component withSearchOrder:(KIFPickerSearchOrder)searchOrder;
UIDatePicker
//與UIPickerView基本操作一致淮蜈,具體可以參考源碼
- (void)selectDatePickerValue:(NSArray *)datePickerColumnValues;
- (void)selectDatePickerValue:(NSArray *)datePickerColumnValues withSearchOrder:(KIFPickerSearchOrder)searchOrder;
Switch
//開(kāi)關(guān)控件
//參數(shù):
//switchIsOn:控制開(kāi)還是關(guān)
//搜索參數(shù):AccessibilityLabel輔助功能標(biāo)示/UIAccessibilityElement+ switchView
- (void)setOn:(BOOL)switchIsOn forSwitchWithAccessibilityLabel:(NSString *)label;
- (void)setSwitch:(UISwitch *)switchView element:(UIAccessibilityElement *)element On:(BOOL)switchIsOn;
Slider
//滑塊控件
//value:滑動(dòng)程度
//搜索參數(shù):AccessibilityLabel輔助功能標(biāo)示/UISlider 對(duì)象指針控件
- (void)setValue:(float)value forSliderWithAccessibilityLabel:(NSString *)label;
- (void)setValue:(float)value forSlider:(UISlider *)slider;
Stepper
- (void)tapStepperWithAccessibilityLabel:(NSString *)accessibilityLabel increment:(KIFStepperDirection)stepperDirection;
- (void)tapStepperWithAccessibilityElement:(UIAccessibilityElement *)element increment:(KIFStepperDirection)stepperDirection inView:(UIView *)view;
系統(tǒng)性操作
動(dòng)畫(huà)相關(guān)
//等待動(dòng)畫(huà)消失
//參數(shù):
//timeout(NSTimeInterval):等待超時(shí)時(shí)間
//stabilizationTime(NSTimeInterval):睡眠時(shí)間废离,一般睡眠時(shí)間內(nèi)不會(huì)探測(cè)動(dòng)畫(huà)是否結(jié)束
- (void)waitForAnimationsToFinish;
- (void)waitForAnimationsToFinishWithTimeout:(NSTimeInterval)timeout;
- (void)waitForAnimationsToFinishWithTimeout:(NSTimeInterval)timeout stabilizationTime:(NSTimeInterval)stabilizationTime;
鍵盤(pán)
//等待鍵盤(pán)出現(xiàn)
- (void)waitForSoftwareKeyboard;
//等待鍵盤(pán)出現(xiàn),且可輸入
- (void)waitForKeyInputReady;
//等待鍵盤(pán)消失
- (void)waitForAbsenceOfSoftwareKeyboard;
相冊(cè)
//選擇指定相冊(cè)的指定位置圖片
//參數(shù):
//albumName:相冊(cè)名
//row:行
//column:列
- (void)choosePhotoInAlbum:(NSString *)albumName atRow:(NSInteger)row column:(NSInteger)column;
第一響應(yīng)
等待目標(biāo)控件活動(dòng)第一響應(yīng)
- (void)waitForFirstResponderWithAccessibilityLabel:(NSString *)label;
- (void)waitForFirstResponderWithAccessibilityLabel:(NSString *)label traits:(UIAccessibilityTraits)traits;
通知/URL的監(jiān)聽(tīng)
//監(jiān)聽(tīng)某個(gè)對(duì)象接受的指定通知
//參數(shù):
//name:通知名稱
//object:監(jiān)聽(tīng)的對(duì)象
//block:監(jiān)聽(tīng)后需要執(zhí)行的代碼塊
- (NSNotification *)waitForNotificationName:(NSString*)name object:(id)object;
- (NSNotification *)waitForNotificationName:(NSString *)name object:(id)object whileExecutingBlock:(void(^)())block;
//監(jiān)聽(tīng)指定的URL訪問(wèn)
//基本原理是通過(guò)hock openURL來(lái)實(shí)現(xiàn)
//參數(shù)
//URLString:監(jiān)聽(tīng)的目標(biāo)url
//block:監(jiān)聽(tīng)到后需要執(zhí)行的代碼塊
//returnValue:標(biāo)記位礁芦,hock函數(shù)是否打開(kāi)
- (void)waitForApplicationToOpenURL:(NSString *)URLString whileExecutingBlock:(void(^)())block returning:(BOOL)returnValue;
- (void)waitForApplicationToOpenAnyURLWhileExecutingBlock:(void(^)())block returning:(BOOL)returnValue;
//與上述函數(shù)一致,差異在于傳遞的URLScheme(通過(guò)配置可以在瀏覽器打開(kāi)應(yīng)用)
- (void)waitForApplicationToOpenURLWithScheme:(NSString *)URLScheme whileExecutingBlock:(void (^)())block returning:(BOOL)returnValue;
其他
//在屏幕上關(guān)閉一個(gè)popover的彈窗
- (void)dismissPopover;
//點(diǎn)擊status bar
- (void)tapStatusBar;
//模擬home鍵點(diǎn)擊
- (void)deactivateAppForDuration:(NSTimeInterval)duration
// 關(guān)閉系統(tǒng)彈窗悼尾,關(guān)閉成功返回ture柿扣,反之返回false
- (BOOL)acknowledgeSystemAlert;
//設(shè)置指定視圖的文案
- (void)setText:(NSString *)text intoViewWithAccessibilityLabel:(NSString *)label;
//獲取指定視圖的文案
- (NSString *)textFromView:(UIView *)view;
//截屏
- (void)captureScreenshotWithDescription:(NSString *)description;
//模擬內(nèi)存報(bào)警
- (void)simulateMemoryWarning;
//模擬橫豎屏切換
- (void)simulateDeviceRotationToOrientation:(UIDeviceOrientation)orientation;