当我这样做时:
// --------------- SETTING NAVIGATION BAR LEFT BUTTON
activityIndicator = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(0.0,0.0,25.0,25.0)];
[activityIndicator sizeToFit];
activityIndicator.autoresizingMask =
(UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin);
UIBarButtonItem *loadingView = [[UIBarButtonItem alloc]
initWithCustomView:activityIndicator];
//loadingView.target = self;
self.navigationItem.leftBarButtonItem = loadingView;
[activityIndicator startAnimating];
// ---------------
它隐藏了我的后退箭头按钮(我用来回到前一个控制器的那个)...为什么会这样?!?
我应该如何在后箭头旁边添加activityIndicator? (我已经使用了titleView和rightbarbuttonitem)
答案 0 :(得分:1)
leftBarButtonItem默认为后退箭头。当您将其设置为其他内容时,则会丢失内置后退按钮。
如果你需要一个带有活动指示的自定义后退按钮,你需要自己提供它,然后当按下按钮时你需要调用
[self.navigationController popViewControllerAnimated:YES];