- 浏览: 1438714 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (691)
- linux (207)
- shell (33)
- java (42)
- 其他 (22)
- javascript (33)
- cloud (16)
- python (33)
- c (48)
- sql (12)
- 工具 (6)
- 缓存 (16)
- ubuntu (7)
- perl (3)
- lua (2)
- 超级有用 (2)
- 服务器 (2)
- mac (22)
- nginx (34)
- php (2)
- 内核 (2)
- gdb (13)
- ICTCLAS (2)
- mac android (0)
- unix (1)
- android (1)
- vim (1)
- epoll (1)
- ios (21)
- mysql (3)
- systemtap (1)
- 算法 (2)
- 汇编 (2)
- arm (3)
- 我的数据结构 (8)
- websocket (12)
- hadoop (5)
- thrift (2)
- hbase (1)
- graphviz (1)
- redis (1)
- raspberry (2)
- qemu (31)
- opencv (4)
- socket (1)
- opengl (1)
- ibeacons (1)
- emacs (6)
- openstack (24)
- docker (1)
- webrtc (11)
- angularjs (2)
- neutron (23)
- jslinux (18)
- 网络 (13)
- tap (9)
- tensorflow (8)
- nlu (4)
- asm.js (5)
- sip (3)
- xl2tp (5)
- conda (1)
- emscripten (6)
- ffmpeg (10)
- srt (1)
- wasm (5)
- bert (3)
- kaldi (4)
- 知识图谱 (1)
最新评论
-
wahahachuang8:
我喜欢代码简洁易读,服务稳定的推送服务,前段时间研究了一下go ...
websocket的helloworld -
q114687576:
http://www.blue-zero.com/WebSoc ...
websocket的helloworld -
zhaoyanzimm:
感谢您的分享,给我提供了很大的帮助,在使用过程中发现了一个问题 ...
nginx的helloworld模块的helloworld -
haoningabc:
leebyte 写道太NB了,期待早日用上Killinux!么 ...
qemu+emacs+gdb调试内核 -
leebyte:
太NB了,期待早日用上Killinux!
qemu+emacs+gdb调试内核
ios8是main.storyboard
不是原来的用file's owner绑定了
连线全练到View Controller就行了
参考
http://www.weheartswift.com/how-to-make-a-simple-table-view-with-ios-8-and-swift/
参考http://toyota2006.iteye.com/blog/841738
把autorelease设置成no
ViewController.h
ViewController.m
加个自适应都输入文本输入框
不是原来的用file's owner绑定了
连线全练到View Controller就行了
参考
http://www.weheartswift.com/how-to-make-a-simple-table-view-with-ios-8-and-swift/
参考http://toyota2006.iteye.com/blog/841738
把autorelease设置成no
ViewController.h
#import <UIKit/UIKit.h> @interface ViewController : UIViewController<UITableViewDelegate,UITableViewDataSource>{ IBOutlet UITableView *tableViewList; NSMutableArray *dataItems; } @end
ViewController.m
#import "ViewController.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; dataItems=[[NSMutableArray alloc]initWithObjects:@"中国",@"美国",@"日本",nil]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [dataItems count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } NSUInteger row=[indexPath row]; cell.textLabel.text=[dataItems objectAtIndex:row]; return cell; } @end
加个自适应都输入文本输入框
#import <UIKit/UIKit.h> @interface ViewController : UIViewController<UITableViewDelegate,UITableViewDataSource,UITextFieldDelegate>{ IBOutlet UITableView *tableViewList; NSMutableArray *dataItems; IBOutlet UITextField *talktxt; } @end
#import "ViewController.h" @interface ViewController () @end @implementation ViewController int prewTag ; //编辑上一个UITextField的TAG,需要在XIB文件中定义或者程序中添加,不能让两个控件的TAG相同 float prewMoveY; //编辑的时候移动的高度 - (void)viewDidLoad { [super viewDidLoad]; //dataItems=[[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",nil]; talktxt.returnKeyType=UIReturnKeyDone; talktxt.delegate=self; } - (void)textFieldDidBeginEditing:(UITextField *)textField{ CGRect textFrame = textField.frame; float textY = textFrame.origin.y+textFrame.size.height; float bottomY = self.view.frame.size.height-textY; if(bottomY>=216) //判断当前的高度是否已经有216,如果超过了就不需要再移动主界面的View高度 { prewTag = -1; return; } prewTag = textField.tag; float moveY = 216-bottomY; prewMoveY = moveY; NSTimeInterval animationDuration = 0.30f; CGRect frame = self.view.frame; frame.origin.y -=moveY;//view的Y轴上移 frame.size.height +=moveY; //View的高度增加 self.view.frame = frame; [UIView beginAnimations:@"ResizeView" context:nil]; [UIView setAnimationDuration:animationDuration]; self.view.frame = frame; [UIView commitAnimations];//设置调整界面的动画效果 } -(void) textFieldDidEndEditing:(UITextField *)textField { if(prewTag == -1) //当编辑的View不是需要移动的View { return; } float moveY ; NSTimeInterval animationDuration = 0.30f; CGRect frame = self.view.frame; if(prewTag == textField.tag) //当结束编辑的View的TAG是上次的就移动 { //还原界面 moveY = prewMoveY; frame.origin.y +=moveY; frame.size. height -=moveY; self.view.frame = frame; } //self.view移回原位置 [UIView beginAnimations:@"ResizeView" context:nil]; [UIView setAnimationDuration:animationDuration]; self.view.frame = frame; [UIView commitAnimations]; [textField resignFirstResponder]; } //键盘都return隐藏键盘 - (BOOL)textFieldShouldReturn:(UITextField *)textField{ [textField resignFirstResponder]; return YES; } - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text { if ([text isEqualToString:@"\n"]) { [textView resignFirstResponder]; return NO; } return YES; } //发送消息 - (IBAction)insertNew:(id)sender { if(!dataItems) { dataItems = [[NSMutableArray alloc] init]; } [dataItems insertObject:talktxt.text atIndex:0]; NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0]; [tableViewList insertRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; talktxt.text=nil; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. dataItems=nil; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [dataItems count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease]; } NSUInteger row=[indexPath row]; cell.textLabel.text=[dataItems objectAtIndex:row]; return cell; } - (void)dealloc { [talktxt release]; [super dealloc]; } @end
发表评论
-
facebook的socketrocket总结
2018-03-19 13:36 1375最近看了开源的网易的demo https://netease. ... -
使用websocket,双ibeacons判断方向
2014-12-16 04:08 1984只调用ibeacon的接口 // // ViewCon ... -
ios的页面跳转
2014-12-03 17:30 1327一种通过导航,一种直 ... -
打包ipa
2014-11-14 23:10 7301.新建一个文件夹命名为:Payload 2.将buid生成的 ... -
理解iOS7的Multipeer Connectivity框架
2014-11-13 23:39 873例子可跑 http://www.oschina.net/tr ... -
ios指南针
2014-10-25 17:06 1041参考http://blog.sina.com.cn/s/blo ... -
linux下编译objectc
2014-10-23 01:24 852编译静态库给ios使用 http://www.tuicool. ... -
ios加速计和陀螺仪
2014-10-22 23:03 1201ios设备中有的加速计可以测量出加速度和重力。陀螺仪可用于确定 ... -
ios仿微信的demo
2014-10-20 00:31 2297910月19日闲的蛋疼,做了个 仿微信的聊天工具 git地址:h ... -
自制微信的ui
2014-10-19 22:28 866参考http://ios.9tech.cn/news/2013 ... -
ios的opencv的helloworld
2014-10-12 23:38 932xcode6, 学习的源码在 http://opencv.or ... -
ios opencv的一些资源
2014-10-11 00:08 766opencv for ios build http://ww ... -
ios客户端websocket的helloworld
2014-10-09 02:11 23131ios8,xcode6 https://github.com/ ... -
ios8的定位,蓝牙与ios7的区别
2014-10-06 23:27 3609以前程序的地理定位功能在iOS8 版上不能工作了(也可能其 ... -
ios的helloworld 2
2014-09-09 21:51 1263参考视频: www.imooc.com/learn/149 S ... -
ios的helloworld
2014-09-08 19:51 659参考http://www.macx.cn/thread-210 ... -
生成ipa 这个是自己总结的,ios5.1.1越狱系统,xcode4.3.3可用
2012-07-29 20:44 1942最有用的一段 export CODESIGN_ALLOCA ... -
ios上使用gcc
2012-07-18 23:21 3205安装network-cmds apptitude iphone ... -
m3u8在windows上预览
2012-06-12 14:25 6959<html> <head> ... -
cocoahttpserver
2012-03-21 22:19 1912https://github.com/robin/cocoa- ...
相关推荐
IOS开发 tableview中cell的用法 值得拥有
ios中tableview下拉出发tableview更新的效果实现。 iPhone5.1 测试成功
tableView的多项选择删除
UITableViewDataSource,UITableViewDelegate中的代理方法
tableVIew点击展开
ios开发 3d tableview效果不错哦
应用ios8新特性,ios8下tableviewcell内容自适应
iOS tableview 展开与收回
ios中最重要的一个控件tableView的各种使用,包括自定义,字典的各种使用(涵7套代码),希望各位屌丝能用的上
继承了刷新、空白页、数据请求 小小的封装不喜勿喷!github:https://github.com/MuYanQin/QQtableView.git
论坛有朋友因为嵌套tableview,没办法保存按钮的点击状态困惑了好多天,因此写了这个demo,想来会有人需要这样的代码,所以发布上来,大家互帮互助,不过本人代码风格不是很好,大家可以凑合参考一下思路,注释写的...
tableview编辑删除
IOS 折叠TableView 类似QQ好友列表的实现
让Tableview 每个Section拥有圆角加阴影
tableview 动态添加
很方便的实现自定义的tableview
swift ,使用autolayout + storyboard 最外层tableview列表,cell里面嵌套了tableview,自适应内容,cell里的tableview不可滑动,内容全部显示,且文字分行显示,不用设置cell的高度直接可以自适应内容
在下边的小例子中,我们将先实现显示一列数据,然后在每行添加图像,之后再看看UITableViewCell的四种分别是什么样的。最后再进行其他操作,比如设置缩进、修改字体大小和行高等。
iOS TableView 添加手势方法
demo中有详细解释