美文网首页
键盘操作

键盘操作

作者: nothing_c | 来源:发表于2016-11-01 00:16 被阅读5次

键盘216+35    0.35  0.25

#import" cTableViewController.h"

//UITextFieldDelegate导入UITextField代理,使用代理绑定的方法,BOOL类型

@interface cTableViewController() {

UIView * view;

}

@end

@implementation cTableViewController

-(void)dealloc {

[view release];

[super dealloc];

}

- (void)viewDidLoad {

[super viewDidLoad];

//注册cell

[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];

//self.tableView.bounces = NO;

//清除tableView的行线条

self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

//定义tableView的背景图片

UIView * backgroundView   = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds] ] autorelease];

//backgroundView  tableView的属性

self.tableView.backgroundView = backgroundView;

UIImageView * image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];

image.image= [UIImage imageNamed:@"5.jpg"];

//添加到属性视图上

[self.tableView.backgroundView addSubview:image];

[image release];

//自定义view来做动画移动

view = [[UIView alloc] initWithFrame:CGRectMake(0, 440, 320, 40)];

view.backgroundColor = [UIColor lightGrayColor];

[self.tableView addSubview:view];

UITextField * tf = [[UITextField alloc] initWithFrame:CGRectMake(10, 2, 250, 36)];

tf.backgroundColor= [UIColor whiteColor];

//tf.layer.masksToBounds = 3;

//设置代理

tf.delegate =self;

//总清除按钮

tf.clearButtonMode = UITextFieldViewModeWhileEditing;

//边框样式

tf.borderStyle = UITextFieldViewModeAlways;

//点击return让键盘下去UIControlEventEditingDidEndOnExit结束编辑,键盘下落

[tf addTarget:selfaction:@selector(KeybordDown) forControlEvents:UIControlEventEditingDidEndOnExit];

[viewa ddSubview:tf];

[tf release];

UIButton * btn = [[UIButton alloc] initWithFrame:CGRectMake(260, 0, 60, 40)];

[btn setTitle:@"发送" forState:UIControlStateNormal];

[btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];

[view addSubview:btn];

[btn release];

}

//键盘下落之后的操作动画

-(void)KeybordDown {

//view下落

[UIView animateWithDuration:0.25animations:^{

view.frame = CGRectMake(0, 440, 320, 40);

} ];

}

//UITextField的代理方法

-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField {

//view上来

[UIView animateWithDuration:0.35animations:^{

view.frame =CGRectMake(0, 480-252-40, 320, 40);

} ];

return YES;

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

return 0;

}

- (NSInteger)tableView:(UITableView * )tableView numberOfRowsInSection:(NSInteger)section {

return0;

}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath {

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];

//    if (!cell) {

//        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];

//    }

// Configure the cell...

return cell;

}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {

return 0;

}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

return [[UIScreen mainScreen] bounds].size.height;

}

@end

相关文章

  • 键盘操作

    键盘216+35 0.35 0.25 #import" cTableViewController.h" //UI...

  • 《键盘操作》

    一 Ctrl键功能 1 Ctrl S 保存 2、Ctrl W 关闭程序 3 Ctrl N 新建 4 ...

  • 键盘操作

    键盘操作:全选、复制、剪切、粘贴 实现方式: 需要引入Keys()from selenium.webdriver....

  • 键盘操作

    from seleniumimport webdriver # 调用keys模块 from selenium.we...

  • 键盘操作

    1、write写入一个字符串,还可以传入interval表示写入每个字符之间的间隔 2、typewrite主要的键...

  • 【python+selenium】键盘事件

    selenium 提供了一整套的模拟键盘操作事件 前提: 模拟键盘的操作需要先导入键盘模块: from selen...

  • iOS 使用touchBegan隐藏键盘后,UIButton和U

    隐藏键盘操作,是开发中常见操作。一般,我们可以通过下面的方式,来隐藏键盘。 隐藏键盘的处理逻辑如下: - (voi...

  • 3.4 UiPath键盘操作的介绍和使用

    键盘操作的介绍模拟用户使用键盘操作的一种行为:例如使用发送热键(Sendhotkey),输入信息 (Typeint...

  • 按键操作

    例如按键盘回车键、回退键,通过键盘进行复制、粘贴等操作。在模拟键盘操作之前也需要导入Keys类,代码如下: fro...

  • Android键盘操作

    一、自动弹出关闭键盘 二、Android:windowSoftInputMode属性设置 stateUnspeci...

网友评论

      本文标题:键盘操作

      本文链接:https://www.haomeiwen.com/subject/dctmuttx.html