我有基於導航控制器的應用程序,一個viewcontroller以橫向模式呈現模態圖形。然後,我添加工具欄完成按鈕關閉圖形vc並返回到導航和肖像模式。將工具欄放在屏幕頂部,在底部有正確的陰影
我無法弄清楚如何將工具欄位置上與工具欄的底部正確的陰影圖形視圖 - 控制的頂部。到目前爲止,我有這段代碼將工具欄添加到底部位置,在工具欄頂部有默認陰影。是否允許在屏幕上方顯示工具欄?由於強制定向旋轉的原因,我不能使用導航控制器與圖形vc。平臺僅限iOS7和iPhone。謝謝。
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(self.view.bounds.origin.x, self.view.bounds.size.width - 44.0, self.view.bounds.size.height, 44.0)];
UIBarButtonItem *flexibleSpaceButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
UIBarButtonItem *doneButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(done)];
toolbar.items = [NSArray arrayWithObjects:flexibleSpaceButtonItem, doneButtonItem, nil];
[self.view addSubview:toolbar];
圖形視圖控制器呈現在橫向,因此我認爲寬度和高度互換我希望? –
看到我修正的答案。 – Mundi
我試過這個,xcode抱怨'賦值只讀屬性':( –