0
我試圖實現我自己的CustomUIActionSheet。UIActionSheet showInView方法如何插入其視圖?
我有它幾乎工作,但我不知道showInView方法如何工作。
- (無效)showInView:(UIView的*)查看
給人一種觀點,這種方法可以把它認爲在每一個單一視圖的前面(將其添加到Windows也許?),但它也能夠根據添加的視圖來設置旋轉。
我試着將它添加到我接收的視圖的窗口作爲參數。
CGFloat startPosition = view.window.bounds.origin.y + view.window.bounds.size.height;
self.frame = CGRectMake(0, startPosition, view.window.bounds.size.width, [self calculateSheetHeight]);
[view.window addSubview:self];
self.blackOutView = [self buildBlackOutViewWithFrame:view.window.bounds];
[view.window insertSubview:self.blackOutView belowSubview:self];
通過,當我在景觀呈現的動作片這樣做,所有的作品,只是,動作片從右側apears(因爲Windows系統引用其始終不變)
從來就還試圖將其添加到視圖窗口那樣的RootViewController的:
UIView * view = view.window.rootViewController.view;
CGFloat startPosition = view.bounds.origin.y + view.bounds.size.height;
self.frame = CGRectMake(0, startPosition, view.bounds.size.width, [self calculateSheetHeight]);
[view addSubview:self];
self.blackOutView = [self buildBlackOutViewWithFrame:view.bounds];
[view insertSubview:self.blackOutView belowSubview:self];
但同樣,它在景觀失敗,它不添加任何東西,或者至少,我看不出它
所以,我的問題是,我該如何將視圖添加到以兩種方向工作的層次結構的頂部?
非常感謝!