Вопрос

Following a previous answer, I am implementing this piece of code to add a UIBarButtonItem to my viewController:

[self.navigationItem setHidesBackButton:YES];

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRewind target:self action:selector(backButton:)];
backButton.tintColor = [UIColor redColor];

self.navigationItem.rightBarButtonItem = backButton;

The error warning is:

Expected )

at backButton declaration line.

I have searched the internet to find the valid format of the declaration, but I think it is correct as it is now, but the compiler shows the error warning.

Any help is welcome.

Это было полезно?

Решение

UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRewind target:self action:@selector(backButton:)];
backButton.tintColor = [UIColor redColor];

self.navigationItem.rightBarButtonItem = backButton;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top