以下是我的代码和图片可见但不是标题
class PromotionScreen < PM::GroupedTableScreen
title 'User screen'
include ProfileImageHelpers
def on_load
set_nav_bar_button :left, {
title: 'Dev',
image: user_profile_image(Auth.current_user),
action: :nil
}
end
end
谢谢!
答案 0 :(得分:0)
iOS提供了将自定义视图添加到UINavigationBarButtonItem
的选项。代码在Objective-C中如下所示。
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setBackgroundImage:[UIImage imageNamed:@""] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(btnTapped:) forControlEvents:UIControlEventTouchUpInside];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:btn];
在swift中使用相同的逻辑。