0

我想在导航栏中的后退按钮右侧有一个 uibarbuttonitem(如果苹果指南没有错)。我使用这段代码:

UIBarButtonItem listButton = new UIBarButtonItem ("List View",UIBarButtonItemStyle.Bordered ,null);


        //assigning left bar buttons
        this.NavigationItem .LeftBarButtonItems =
        new UIBarButtonItem[] { this.NavigationItem .BackBarButtonItem   ,listButton }  ;

this.NavigationItem .BackBarButtonItem始终为空。什么解决方案适合这个目的?

4

1 回答 1

0

这是相同的正确实现:

UIButton *leftButtonIcon = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, width, height)];
[leftButtonIcon setImage:[UIImage imageNamed:@"yourButtonImageName.png"] forState:UIControlStateNormal];
[leftButtonIcon addTarget:self.viewDeckController action:@selector(YourSelectorMethod) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *leftbtn = [[UIBarButtonItem alloc] initWithCustomView:leftButtonIcon];
[self.navigationItem setLeftBarButtonItem:leftbtn];
于 2013-04-22T07:27:45.650 回答