我想在 IOS 7.0 中添加导航栏,并在其上添加栏按钮项。所以请建议如何在IOS应用程序中添加导航栏。
UIButton *btnBack=[UIButton buttonWithType:UIButtonTypeCustom];
[btnBack setImage:[UIImage imageNamed:@"aerrow-previous.png"] forState:UIControlStateNormal];
[btnBack setImage:[UIImage imageNamed:@"aerrow-previous.png"] forState:UIControlStateSelected];
[btnBack setTintColor:[UIColor clearColor]];
[btnBack setFrame:CGRectMake(5, 5, 20, 21)];
[btnBack addTarget:self action:@selector(backBtnPressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *leftBarButton=[[UIBarButtonItem alloc]initWithCustomView:btnBack];
[self.navigationItem setLeftBarButtonItem:leftBarButton];
btnBack = nil;
leftBarButton = nil;
// Add back button on navigation bar
UILabel *titileview=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 150, 44)];
[titileview setTextColor:[UIColor colorWithRed:(87.0f/255.0f) green:(87.0f/255.0f) blue:(87.0f/255.0f) alpha:1.0f]];
[titileview setText:@"SIGN IN"];
[titileview setTextAlignment:NSTextAlignmentCenter];
[titileview setBackgroundColor:[UIColor clearColor]];
[self.navigationItem setTitleView:titileview];
titileview = nil;