我有一個SplitViewController,具有rightbarbuttonitem,我rightbarbuttonitem是出界的rightbarbuttomitem是出界時,我對its'n當我從縱向到橫向改變方向調整導航的變化方向在splitviewcontroller
的rightbarbuttomitem是一個customview(藍色背景)。
我重視這個問題的一些圖片:
而且我的代碼:
中的appdelegate:
masterViewController = [[MasterViewController alloc] initWithFeed:feedData];
UINavigationController *masterNavigationController = [[UINavigationController alloc] initWithRootViewController:masterViewController];
detailViewController = [[DetailViewController alloc] initWithFeed:[feedData.secciones objectAtIndex:0]];
[detailViewController setSeccionData:[feedData.secciones objectAtIndex:0]];
UINavigationController *detailNavigationController = [[UINavigationController alloc] initWithRootViewController:detailViewController];
detailNavigationController.navigationBar.tintColor = [UIColor getHexColorWithRGB:@"e2de09" alpha:1.0f];
self.splitViewController = [[UISplitViewController alloc] init];
self.splitViewController.delegate = detailViewController;
masterViewController.delegate=detailViewController;
self.splitViewController.viewControllers = [NSArray arrayWithObjects:masterNavigationController, detailNavigationController, nil];
self.window.rootViewController=self.splitViewController;
,並在我的DetailViewController地初始化rightbarbuttoni TEM使用自定義視圖:
self.navigationItem.rightBarButtonItem=nil;
NSArray *buttons;
buttons = [NSArray arrayWithObjects:@"send",@"reload",nil];
tools=[[Toolbar alloc] initWithFrame:CGRectMake(0, 0, 110, 30) parentController:detalleDG buttons:buttons];
tools.delegate=self;
UIBarButtonItem *btnRight=[[UIBarButtonItem alloc] initWithCustomView:tools.view];
self.navigationItem.rightBarButtonItem=btnRight;
我與 detailNavigationController.navigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth嘗試;或者 tools.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 但沒有什麼
有什麼建議嗎?由於
我的工具欄是UIView,所以我試圖通過UIToolbar更改它,它現在可以工作 – mcalleja 2012-04-12 21:21:16