我需要将 navigationItem TitleView 对齐到最右边。 (navigationItem rightBarButtonItem 通常出现的地方)
如何做到这一点?
我已经尝试过了,但没有运气,它仍然将 TitleView 放在中心:
CGRect titleViewPos = CGRectMake(300, 0, 200, 10);
self.navigationItem.titleView.frame = titleViewPos;
UILabel *lbl = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 320, 44)];
lbl.textAlignment = UITextAlignmentRight;
lbl.backgroundColor = [UIColor clearColor];
lbl.text = @"TITLEVIEW";
self.navigationItem.titleView = lbl;
你会得到输出
关于iphone - 右对齐 self.navigationItem setTitleView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16296828/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |