navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40)];
[self.view addSubview:navBar]; navBar.barStyle = UIBarStyleDefault; [navBar release]; UIBarButtonItem* cancelBtnItem = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStylePlain target:self action:@selector(cancelBtnPress)]; UIBarButtonItem* sureBtnItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStyleDone target:self action:@selector(sureBtnPress)]; UINavigationItem* navItem = [[UINavigationItem alloc] initWithTitle:@"设置经度"]; navItem.leftBarButtonItem = cancelBtnItem; navItem.rightBarButtonItem = sureBtnItem; navItem.hidesBackButton = YES; [cancelBtnItem release]; [sureBtnItem release];navigationController.navigationBar.tintColor = [UIColor colorWithRed:(21.0/255.0) green:(153.0 / 255.0) blue:(224.0 / 255.0) alpha:1];
[navBar pushNavigationItem:navItem animated:NO]; [navItem release];