去掉UISearchBar自带的的边框背景

去掉UISearchBar自带的的边框背景 ,分为ios7后和ios7前的解决方案,代码如下:

UISearchBar* searchbar = [[UISearchBar
alloc]initWithFrame:CGRectMake(5,
0, 310,
50)];

searchbar.tag =
1000;

searchbar.delegate =
self;

[cell
addSubview:searchbar];

for (UIView *view
in searchbar.subviews) {

// for before iOS7.0

if ([view isKindOfClass:NSClassFromString(@"UISearchBarBackground")])
{

[view
removeFromSuperview];

break;

}

// for later iOS7.0(include)

if ([view isKindOfClass:NSClassFromString(@"UIView")] && view.subviews.count
> 0) {

[[view.subviews
objectAtIndex:0]
removeFromSuperview];

break;

}

}

时间: 2024-07-31 17:13:40

去掉UISearchBar自带的的边框背景的相关文章

Android通过用代码画虚线椭圆边框背景来学习一下shape的用法

在Android程序开发中,我们经常会去用到Shape这个东西去定义各种各样的形状,shape可以绘制矩形环形以及椭圆,所以只需要用椭圆即可,在使用的时候将控件比如imageview或textview的高宽设置成一样就是正圆,solid表示远的填充色,stroke则代表远的边框线,所以两者结合可以实现带边缘的圆,当然也可以直接加上size控制高宽.那么我首先带你们了解一下Shape下有哪些标签,并且都代表什么意思: shape属性: rectangle:矩形 oval:椭圆 line:线,需要

android 用代码画虚线边框背景

               1.虚线画效果,可以使用Android中的xml来做. 2.直接上代码: <RelativeLayout android:id="@+id/coupon_popup" android:layout_width="320dp" android:layout_height="200dp" android:layout_margin="20dp" android:gravity="cen

如何去掉添加链接后图片的边框

如何去掉添加链接后图片的边框: IE浏览器中,默认状态下,如果给图片添加链接图片会产生边框.只要为图片的CSS代码添加border:0px即可. 代码实例: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="author" content="http://www.51texiao.cn/" /> <ti

【Android】编写Drawable XML绘制底部带指示条的背景

要实现的就是类似于Actionbar标签的那种效果,底部有一条指示条. 实现代码: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:top="-6dp" android:left="-6d

android 用代码画虚线边框背景(转)

1.虚线画效果,可以使用Android中的xml来做. 2.直接上代码: <RelativeLayout android:id="@+id/coupon_popup" android:layout_width="320dp" android:layout_height="200dp" android:layout_margin="20dp" android:gravity="center_vertical&qu

ios去掉navigationController和tabBarController里的边框黑线

ios去掉navigationController和tabBarController里的边框黑线 by 伍雪颖 - (void)viewWillAppear:(BOOL)animated { [self.navigationController.navigationBar setBackgroundImage:[TDUtils createImageWithColor:[UIColor clearColor]] forBarMetrics:UIBarMetricsDefault]; [self.

EditText自定义边框背景与动态检测用户输入

一.EditText自定义边框背景 1.效果演示 2.代码实现 (1)res/drawable/shape_edit_normal.xml 功能:编辑框没获得焦点时,使用该shape.<shape.../>为根元素的ShapeDrawable资源,主要用于定义一个基本的几何图形,如矩形.圆形.线条等. <solid.../>子元素用于指定填充集合图形的的颜色: <corners.../>子元素用于定义几个图形的四个角的弧度: <gradient../>子元素

Android 自定义android控件EditText边框背景

在我们进行Android应用界面设计和时候,为了界面风格的统一,我们需要对一些控件进行自定义.比如我们的应用采用的蓝色风格,但是 android的EditText控制获得焦点后显示的却是黄色的边框背景.那么如何让EditText在获得焦点的时候显示的是我们自定义的蓝色的背景 呢? 首先准备两张图片,一张是EditText获得焦点后的边框背景,一张是没有获得焦点时的背景,注意制作成9.png样式的图片,然后在drawable里添加一个selector_edittext_bg.xml文件,内容如下:

css简单实现带箭头的边框

原文地址 https://tianshengjie.cn/artic... css简单实现带箭头的边框 普通边框 <style> .border { width: 100px; height: 50px; border: 1px solid red; } </style> <div class="border"></div> 实现由四个三角形组成的正方形 <style> .triangle { width: 0; height