【代码笔记】点击搜索按钮,或放大镜后都会弹出搜索框
2016-02-29 09:30
302 查看
一, 效果图。
二,工程图。
三,代码。
RootViewController.h
RootViewController.m
二,工程图。
三,代码。
RootViewController.h
#import <UIKit/UIKit.h> #import "CLHSearchBar.h" @interface RootViewController : UIViewController <CLHSearchBarDelegate> @end
RootViewController.m
#import "RootViewController.h" @interface RootViewController () @end @implementation RootViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor=[UIColor grayColor]; //添加搜索栏 CLHSearchBar* searchBar = [[CLHSearchBar alloc] initWithFrame:CGRectMake(0, 90, 0, 0) delegate:self]; [self.view addSubview:searchBar]; } #pragma -mark -FCSearchBar delegate //按照聊天内容和昵称进行查询 //点击搜索按钮,或放大镜后都会弹出搜索框 - (void)CLHSearchBarDidSearch:(CLHSearchBar *)clhSearchBar text:(NSString *)text { NSLog(@"text = %@",text); UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"提醒" message:@"搜索按钮已点击" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; [alert show]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. }
相关文章推荐
- Google Java Style 编程风格指南 中文版
- 【代码笔记】点击搜索按钮,或放大镜后都会弹出搜索框
- java jsp失效问题--待解决
- xml解析构建帮助类
- Java 学习笔记 ------第四章 认识对象
- python 用生成器生成斐波那契数列
- datetime使用笔记
- 在python中怎么生成html格式的邮件并发送
- eclipse|studio 导出hprof 后用MAT显示报错Unknown HPROF Version
- SpringMVC(一)——流程框架总体介绍
- m文件转dll
- 闭包学习
- python中for循环的小技巧
- vb.net版三层登录
- [c++]win下utf8源文件编译运行后乱码,codeblocks编辑器
- Ubuntu12.04中安装和配置Java JDK
- python入门教程(1)安装和下载
- jdk的设置及安装android studio提示does not point to a valid jvm问题
- 开源 java CMS - FreeCMS2.4 模型管理
- 《基于MFC的OpenGL编程》Part 6 Animation