Как я могу установить заголовок с изображением или удаленным изображением в левой навигационной панели?
Ниже мой код и изображение видно, но не заголовок
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
Спасибо!
1 ответ
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.