The Notes app uses a small image of ragged paper to imply prior torn pages. I tried to replicate this behaviour in the following way, but my problem is, the search bar doesn't become active anymore.
//mySearchBar and raggedPaper are instance variables
mySearchBa开发者_如何学Gor = [[UISearchBar alloc] initWithFrame:CGRectMake(0,0,320,44)];
mySearchBar.delegate = self;
[mySearchBar sizeToFit];
raggedPaper = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"raggedpaper.png"]];
[raggedPaper addSubView:mySearchBar];
self.tableView.tableHeaderView = raggedPaper;
Everything looks alright, but the searchbar doesn't activate anymore.
Did you try this :
raggedPaper.userInteractionEnabled = YES
Or if it doesn't work, you can do the other way around : add the ragged paper image to the search bar, whose clipsToBounds is set to NO.
精彩评论