I would like to add gradient in UISearchController
not work.
self.searchController = [[UISearchController alloc] initWithSearchResultsController:nil];
self.searchController.searchResultsUpdater = self;
self.searchController.dimsBackgroundDuringPresentation = NO;
self.searchController.hidesNavigationBarDuringPresentation = NO;
self.searchController.searchBar.delegate = self;
self.definesPresentationContext = YES;
[self.searchController.searchBar setFrame:CGRectMake(0, 0, self.view.frame.size.width, 79)];
CAGradientLayer * grad = [CAGradientLayer layer];
grad.frame = self.searchController.searchBar.bounds;
grad.colors = @[(id)UIColorFromRGB(0x8daf00).CGColor,
(id)UIColorFromRGB(0xd1af03).CGColor];
[ self.searchController.searchBar.layer insertSublayer:grad atIndex:0];