NavigationBar和UINavigationController一样是一个容器,维护了一个UINavigationItem的堆栈。
1、将一个独立的NavigationBar加在view上:
UINavigationBar* navbar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 20, 320, 44)];
UINavigationItem* navItem = [[UINavigationItem alloc] initWithTitle:@"Coverflow2"];
[navbar setItems:@[navItem]];
2、push进去一个UINavigationItem:
UINavigationItem* pushedItem = [[UINavigationItem alloc] initWithTitle:@"pushed"];
[navbar pushNavigationItem:pushedItem animated:YES];
3、pop出当前的UINavigationItem:
[navbar popNavigationItemAnimated:YES];
1、将一个独立的NavigationBar加在view上:
UINavigationBar* navbar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 20, 320, 44)];
UINavigationItem* navItem = [[UINavigationItem alloc] initWithTitle:@"Coverflow2"];
[navbar setItems:@[navItem]];
2、push进去一个UINavigationItem:
UINavigationItem* pushedItem = [[UINavigationItem alloc] initWithTitle:@"pushed"];
[navbar pushNavigationItem:pushedItem animated:YES];
3、pop出当前的UINavigationItem:
[navbar popNavigationItemAnimated:YES];