Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
搜索栏子视图UITextField iphone_Iphone_Ios_Objective C_Cocoa Touch - Fatal编程技术网

搜索栏子视图UITextField iphone

搜索栏子视图UITextField iphone,iphone,ios,objective-c,cocoa-touch,Iphone,Ios,Objective C,Cocoa Touch,我正在通过编程方式使用带有uitextField子视图的搜索栏。我得到的图像如下: 上面一行是深色的。我怎样才能避免得到一条简单的细线 我使用以下代码: searchbar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, (self.view.frame.size.height*10)/100, self.view.frame.size.width, (self.view.frame.size.height*13)/100)]; searc

我正在通过编程方式使用带有uitextField子视图的搜索栏。我得到的图像如下:

上面一行是深色的。我怎样才能避免得到一条简单的细线

我使用以下代码:

searchbar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, (self.view.frame.size.height*10)/100, self.view.frame.size.width, (self.view.frame.size.height*13)/100)];
searchbar.delegate=self;

for (searchBarSubview in [searchbar subviews]) {
    if ([searchBarSubview conformsToProtocol:@protocol(UITextInputTraits)] ) {
        @try {

            [[searchbar.subviews objectAtIndex:0] removeFromSuperview];
            searchbar.backgroundColor=[UIColor clearColor];

        }
        @catch (NSException * e) {
            // ignore exception
        }
    }
}

您可能必须使用UITextField和Images滚动您自己的搜索字段我正在以编程方式使用UITextField,但即使这样,我也无法克服我在图像中提到的暗线。请检查链接,可能会帮助您我只需要避开上面的暗线。