Regarding the problem that the navigation view cannot be hidden: self.navigationItem.rightBarButtonItem.customView.hidden = YES; invalid

self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(doAdd)];
self.navigationItem.rightBarButtonItem.customView.hidden = YES;

It is reasonable to write this way, and there will be no right-side view. . . . but. . . The actual operation found that the meeting exists,,,

Workaround: Customize the navigation. . .

- (UINavigationItem *)rightNavButton {
    if (!navItem) {
        navItem = [[UINavigationItem alloc] init];
    }
    return navItem;
}

self.navItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(doAdd)];
self.navItem.rightBarButtonItem.customView.hidden = YES;

This will not show. . .

very fascinated. . .

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325196826&siteId=291194637