0
升級到iOS 11和XCode9後,我的應用程序的NavigationBar按鈕(左側和右側)沒有響應。它在以前的版本中運行良好,但在iOS 11中不能運行。任何人都可以幫助我或面臨同樣的問題。我的應用程序使用Objective C語言。升級到iOS 11後UiNavigationbar按鈕沒有響應
**//here is code for leftbarbutton**
UIImage *backSVG = [UIImage imageWithSVGNamed:@"backarrow32" targetSize:CGSizeMake(25, 25) fillColor:[UIColor whiteColor]];
UIBarButtonItem *notifyButton = [[UIBarButtonItem alloc] initWithImage:backSVG style:UIBarButtonItemStylePlain target:self action:@selector(handleBackButton)];
[notifyButton setStyle:UIBarButtonItemStylePlain];
self.navigationItem.leftBarButtonItem = notifyButton;
**//Rightbar buttons are**
UIBarButtonItem *rightbar1 = [[UIBarButtonItem alloc] initWithImage:
[UIImage imageWithSVGNamed:@"rightbar1" targetSize:CGSizeMake(21, 21)
fillColor:[UIColor whiteColor]] style:UIBarButtonItemStylePlain target:self
action:nil];
[rightbar1 setAction:@selector(handlerightbar1Action)];
UIBarButtonItem *rightbar2 = [[UIBarButtonItem alloc] initWithImage:
[UIImage imageWithSVGNamed:@"rightbar2" targetSize:CGSizeMake(21, 21)
fillColor:[UIColor whiteColor]] style:UIBarButtonItemStylePlain
target:self action:nil];
[rightbar2 setAction:@selector(handlerightbar2Action)];
[rightbar1 setImageInsets:UIEdgeInsetsMake(0, -30, 0, -50)];
self.navigationItem.rightBarButtonItems = [NSArray
arrayWithObjects:rightbar2, rightbar1, nil];
您的問題可能是由於setImageInsets,請嘗試刪除它。 –
嘗試刪除setImageInsets,但它仍然相同。 –
我看到你有一個擴展'imageWithSVGNamed',編輯你的問題並添加這個擴展,所以我們可以幫助你。 –