不通過push,給viewcontroller自定義UINavigationBar,並加上返回按鈕

im5437發表於2015-05-18

UINavigationBar *navBar =[[[UINavigationBar alloc] initWithFrame:CGRectMake(0,0, self.view.frame.size.width, 44)] autorelease];

    [self.view addSubview:navBar];

   UINavigationItem *navItem = [[[UINavigationItem alloc] init] autorelease];

navBar.items = [NSArray arrayWithObject:navItem];

   [navItem setLeftBarButtonItem:[[[UIBarButtonItemalloc] initWithTitle:@"返回" style:UIBarButtonSystemItemCancel target:self action:@selector(dismissSelfView)] autorelease]];

相關文章