0
我已編程方式添加的導航欄,以我的應用程序如下:如何使導航欄旋轉與設備
//Setup Navigationbar:
navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 20, [[UIScreen mainScreen ] bounds].size.width, 44)];
UINavigationItem *navigItem = [[UINavigationItem alloc] initWithTitle:@"Navigation Title"];
//Navigationbar left items:
UIButton *fileButton = [UIButton buttonWithType:UIButtonTypeCustom];
[fileButton addTarget:self action:@selector(loadFile:) forControlEvents:UIControlEventTouchUpInside];
[fileButton setImage:[UIImage imageNamed:@"menuicon.png"] forState:UIControlStateNormal];
fileButton.frame = CGRectMake(0, 0, 24, 24);
fileButton.backgroundColor=[UIColor clearColor];
newItem = [[UIBarButtonItem alloc] initWithCustomView:fileButton];
navBar.items = [NSArray arrayWithObjects: navigItem,nil];
//NavigationBar appearance:
[navBar setBackgroundImage:[UIImage imageNamed:@"greenbar.png"] forBarMetrics:UIBarMetricsDefault];
[self.window addSubview: navBar];
[self setTitle:@"Empty"];
問題是我不能讓它與設備轉動,正如你所看到的IM增加酒吧到我的AppDelegate的窗戶。我如何使它跟隨旋轉和自動調整大小?