开发者

Image below UISearchBar like Notes app - iPhone

开发者 https://www.devze.com 2023-04-03 17:05 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消