我试图在navigationItem.titleView
中显示活动指示器以及文本“ connecting”。
我设法显示活动指示器,但未显示文本。
我当前的代码:
self.navigationItem.titleView = nil;
UIActivityIndicatorView *aiView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
aiView.hidesWhenStopped = NO;
self.navigationItem.titleView = aiView;
任何想法如何做到这一点?
最佳答案
尝试以下...
// first create main view
UIView *mainView = [[UIView alloc] initWithFrame:.....
// now lets create label that you need to display
UILabel *titleLabel = [[UILabel alloc] initWithFrame:.....
titleLabel.text = @"Title here";
[mainView addSubview:titleLabel];
// now create indicator
UIActivityIndicatorView *indicator = initWithFrame:.....
[mainView addSubview:indicator];
// now add mainView to titleView
self.navigationItem.titleView = mainView;
关于ios - iOS显示事件指示器和文本连接在navigationItem标题中?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22049975/