-1
iOS的11導航問題,我需要設置導航欄
- 這是我當前的代碼左右和標題視圖。
原來是這樣,但現在我有問題吧:
btnMenu = [UIButton buttonWithType:UIButtonTypeSystem]; [btnMenu setFrame:CGRectMake(0, 0, 25, 25)]; [btnMenu setTintColor:[UIColor blackColor]]; [btnMenu setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft]; [btnMenu setImage:[UIImage imageNamed:@"menu"] forState:UIControlStateNormal]; [btnMenu addTarget:self action:@selector(clickOnMenu:) forControlEvents:UIControlEventTouchUpInside]; leftBarButton2 = [[UIBarButtonItem alloc] initWithCustomView:btnMenu]; [arrLeftBarButton addObject:leftBarButton2]; self.navigationItem.leftBarButtonItems = [NSArray arrayWithArray:arrLeftBarButton]; [viewTitle addSubview:search]; [viewTitle addSubview:btnSelectSearch]; viewTitle.translatesAutoresizingMaskIntoConstraints = false; self.navigationItem.titleView = viewTitle; BBBadgeBarButtonItem *badgeNotify = [[BBBadgeBarButtonItem alloc] initWithCustomUIButton:btnNotify]; badgeNotify.badgeBGColor = [UIColor whiteColor]; badgeNotify.badgeTextColor = [UIColor blackColor]; badgeNotify.badgeValue = @"0"; self.navigationItem.rightBarButtonItem = badgeNotify;
看到https://開頭計算器.com/questions/44442573/navigation-bar-rightbaritem-image-button-bug-ios-11 –
It似乎您正在設置導航欄不是建議大小的圖像。查看人機界面指南:https://developer.apple.com/ios/human-interface-guidelines/icons-and-images/custom-icons/ PS:如果您可以發佈您的代碼,我們會更容易。所以可以指出實際問題。 – Rishi