简体   繁体   中英

Adding UISearchBar with Scope button as subview to UIView

I want to add UISearchbar with two scoop button to my UIView. i do not want to either navigation or table view. when user open model view page from sheet comes up with Search option and rest. when user click on Search button scoop button to be visible. i tried to do but i am not getting desire result. 搜索后图片

取消后的图像

how to remove Background of scope button, i have removed uisearchbar, similar way i do not want white background for button. is it possible. showsScopeBar i am making FALSE still background can be visible.

To remove Background image of scope buttons just try :

 Class segmentedControlBackgroundView = NSClassFromString(@"_UISegmentedControlBackgroundView");
    for(UIView *view in self.searchBar.subviews) {
        if([view isKindOfClass:[UISegmentedControl class]]){
            for(UIView *subview in view.subviews) {
                if ([subview isKindOfClass:segmentedControlBackgroundView]) {
                    subview.hidden = YES;
                }
            }
        }
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM