UI一揽子计划 2 (UITextField UIButton)
leftView.backgroundColor = [UIColor greenColor];
2.实现方法
2.如果是就让第二个变成第一响应者
3.如果点的是第二个就让第三个变成第一响应者
4.如果是第三个就回收键盘
UITextField *f1 = (UITextField *)[self.window viewWithTag:101];
[f1 becomeFirstResponder];
} else if (textField.tag == 101 && [textField isFirstResponder] == YES) {
NSLog(@"点的是第二个,将第三个成为第一响应者。");
UITextField *f1 = (UITextField *)[self.window viewWithTag:102];
[f1 becomeFirstResponder];
} else if (textField.tag == 102 && [textField isFirstResponder] == YES) {
NSLog(@"点的是第三个,回收键盘");
[textField resignFirstResponder];
}
return YES;
* 第一响应者
如果取消第一响应者 键盘回收
*/
/**
- (UIResponder*)nextResponder;
- (BOOL)canBecomeFirstResponder; // default is NO
- (BOOL)becomeFirstResponder;
- (BOOL)canResignFirstResponder; // default is YES
- (BOOL)resignFirstResponder;
- (BOOL)isFirstResponder;
注意:不用管理内存
button.frame = CGRectMake(100, 100, 100, 100);
button.backgroundColor = [UIColor greenColor];
[button setTitle:@"普通" forState:(UIControlStateNormal)];
[button setTitle:@"选中" forState:(UIControlStateSelected)];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];
[button setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
[button setTitleColor:[UIColor blueColor] forState:UIControlStateSelected];
[button setImage:image1 forState:UIControlStateSelected];
[button setImage:image2 forState:UIControlStateHighlighted];
NSLog(@"程序小退出状态。");
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- (void)applicationDidEnterBackground:(UIApplication *)application {
NSLog(@"2%s%d", __FUNCTION__,__LINE__);
NSLog(@"程序进入后台挂起状态");
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- (void)applicationWillEnterForeground:(UIApplication *)application {
NSLog(@"3%s%d", __FUNCTION__,__LINE__);
NSLog(@"进入前台。");
- (void)applicationDidBecomeActive:(UIApplication *)application {
NSLog(@"4%s%d", __FUNCTION__,__LINE__);
NSLog(@"进入激活状态");
- (void)applicationWillTerminate:(UIApplication *)application {
NSLog(@"5%s%d", __FUNCTION__,__LINE__);
NSLog(@"程序意外退出");
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application
{
NSLog(@"内存发出警告");
UIKeyboardTypeURL, UIKeyboardTypeNumberPad, UIKeyboardTypePhonePad, UIKeyboardTypeNamePhonePad, UIKeyboardTypeEmailAddress,
} UIKeyboardType;
// URL键盘,有.com按钮;只⽀支持URL字符 //数字键盘
textView.keyboardtype = UIKeyboardTypeNumberPad;
typedef enum { UIKeyboardAppearanceDefault, UIKeyboardAppearanceAlert,
} UIKeyboardAppearance;
textView.keyboardAppearance=UIKeyboardAppearanceDefault;
} UIReturnKeyType;
textView.returnKeyType=UIReturnKeyGo;
textField.autocapitalizationType = UITextAutocapitalizationTypeWords;
} UITextAutocorrectionType;
textField.autocorrectionType = UITextAutocorrectionTypeYes;
UI一揽子计划 2 (UITextField UIButton)相关推荐
- UI一揽子计划 8 (UINavigationController 、界面通信 、NSTimer 、NSUserDefaults)
一.UINavigationController // 创建一个导航控制器 // 创建一个控制器作为根控制器 去管理 RootViewController *rootVC ...
- UI一揽子计划 24 (MVC、通知、)
一.MVC Model - View - Controller 即 模型 - 视图 - 控制器 Modle (模型) 存储 处理数据 为应用程序提供数据. View (视图)展示用户界面视图,提供 ...
- UI一揽子计划 3 (自定义视图、UIViewControllor、屏幕旋转判断和重布局)
一.UIView自定义视图 因为在实际开发过程中,可能由于繁琐的创建相同的Label.textfield和Button组合,为了实现编程工作的高效率,我们可以自定义视图,并且将它们封装起来. ...
- UI一揽子计划 20 (豆瓣实战之图片缓存 、豆瓣实战之详情界面(自适应行高) 、豆瓣实战之登陆注销、刘新林分享之UIAlertController)
一.图片缓存 ActivityModel.m 如果数据加载完毕就将图片放到缓存中. #pragma mark -- imageDownLoader 代理方法 // 成功返回data - (void) ...
- UI一揽子计划 1 (UIView UILabel)
第一天 1.UIView ·建立一个空模板后,首先将ARC模式关闭,因为iOS采用MRC模式,即手动管理内存. ·重写dealloc方法. - (void)dealloc { [_window rel ...
- UI一揽子计划 7 ( UIScrollView、 UIPageControl、综合所学简单相册)
---- 创建一个UIScrollView UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:[UIScreen ma ...
- UI一揽子计划 4 (Touch 、摇一摇、响应者链)
一.touch - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event //开始触摸,就只被执行一次 { // NSLog(@ ...
- UI一揽子计划 6 (UIControl、UISegmentedControl、UIImageView插入数组图片、UISlider)
一 UIControl 是所有控制类控件的基类. · 比如UIButton UISlider UISegmentedControl 等只要跟控件有关系的都继承于UIControl类 ...
- UI一揽子计划 23 (动画的使用场景、UIView动画、CGAffineTransform2D仿射变换、CALayer、CAAnimation、)
在iOS 中的动画是指一些视图上的过渡效果,合理利用动画能提高用户体验. 一. UIView动画 1). UIView动画块的使用 ([UIView beginAnimations: nil cont ...
最新文章
- Mysql insert语句的优化
- android camera viewport rect,Unity 实现屏幕抖动效果(通过Camera Viewport Rect)
- 【数据结构】哈夫曼树与哈夫曼编码
- “ORA-01034 - Oracle not available”和“ORA-27101 - shared memory realm does not exist”
- CUDA学习(三十六)
- 内核网络输出帧的处理
- 文艺小清新手绘秋季秋天叶片,值得设计师收藏的好素材
- 安卓中的数据存储方式以及ContentProvider的简单介绍
- 卸载Windows的引导界面中的变色龙选项
- r语言如何计算t分布临界值_R语言系列第四期:R语言单样本双样本差异性检验...
- 史上最“奇葩”相亲男惊呆网友:你那么普通,却那么自信
- 死理性派恋爱法:拒绝掉前面37%的人
- ubuntu安装视频播放器
- C语言中什么叫做左值?右值?
- 学生成绩管理系统(转载)
- AdaptiveAvgPool1D内部实现
- RISC-V应用于高性能处理器的可能性
- ByteBuffer使用揭秘
- 博时金牛杯(三强)公开大赛
- 奶瓶仔xp主题【主题世界】