1

ich eine SplitViewController haben, mit einem rightbarbuttonitem auf Navigation, die Größenänderung its'n, wenn ich die Ausrichtung von Hochformat auf Querformat zu ändern, meine rightbarbuttonitem ist Grenzen ausrightbarbuttomitem außerhalb der Grenzen ist, wenn ich Orientierung in splitviewcontroller ändern

Die rightbarbutomitem ist eine benutzerdefinierte Ansicht (blauer Farbhintergrund).

lege ich ein paar Bilder des Problems:

NavigationcController in portrait

NavigationController in landscape

Und mein Code:

in 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; 

und in meinem DetailViewController die init rechtsbuttonbuttoni tem mit einer benutzerdefinierten Ansicht:

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; 

Ich habe versucht, mit detailNavigationController.navigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth; oder tools.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; aber nichts

Irgendwelche Vorschläge? Dank

Antwort

0

In dieser Zeile

tools=[[Toolbar alloc] initWithFrame:CGRectMake(0, 0, 110, 30) parentController:detalleDG buttons:buttons]; 

Versuchen Änderung diese

tools=[[Toolbar alloc] initWithFrame:CGRectMake(0, 0, xxxxx.frame.size.width, xxxx.frame.size.height) parentController:detalleDG buttons:buttons]; 

Sie können die „xxxxx“ ändern automatisch Breite und Höhe zu erhalten, nach Ihrer Bildschirmgröße von bartool oder Bildschirm Ihre Ansicht

Hat es geholfen?

+0

Meine Toolbar war ein UIView, also habe ich versucht, es durch eine UIToolbar zu ändern und es funktioniert jetzt – mcalleja

Verwandte Themen