- 浏览: 1444555 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (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调试内核
参考http://ios.9tech.cn/news/2013/1111/38520.html
修改
配置绑定
修改
配置绑定
#import <UIKit/UIKit.h> @interface ViewController : UIViewController { IBOutlet UITableView *tableViewList; IBOutlet UITextField *messageTxt; } @property (nonatomic, strong) NSMutableArray *resultArray; @end
// // ViewController.m // BubbleDemo // // Created by xiao7 on 14/10/19. // Copyright (c) 2014年 killinux. All rights reserved. // #import "ViewController.h" @interface ViewController () @end @implementation ViewController - (IBAction)sendBubbleMessage:(id)sender { NSString *thistext = messageTxt.text; NSLog(@"sendBubbleMessage:%@",thistext); messageTxt.text=nil; NSDictionary *dict8 = [NSDictionary dictionaryWithObjectsAndKeys:@"weixin",@"name",thistext,@"content", nil]; [_resultArray addObject:dict8]; [tableViewList reloadData]; } - (void)viewDidLoad { [super viewDidLoad]; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:@"weixin",@"name",@"这是一个测试",@"content", nil]; NSDictionary *dict1 = [NSDictionary dictionaryWithObjectsAndKeys:@"haoning",@"name",@"hello",@"content", nil]; NSDictionary *dict7 = [NSDictionary dictionaryWithObjectsAndKeys:@"weixin",@"name",@",长数据测试。",@"content", nil]; _resultArray = [NSMutableArray arrayWithObjects:dict,dict1, nil]; [_resultArray addObject:dict7]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } //泡泡文本 - (UIView *)bubbleView:(NSString *)text from:(BOOL)fromSelf withPosition:(int)position{ //计算大小 UIFont *font = [UIFont systemFontOfSize:14]; CGSize size = [text sizeWithFont:font constrainedToSize:CGSizeMake(180.0f, 20000.0f) lineBreakMode:NSLineBreakByWordWrapping]; // build single chat bubble cell with given text UIView *returnView = [[UIView alloc] initWithFrame:CGRectZero]; returnView.backgroundColor = [UIColor clearColor]; //背影图片 UIImage *bubble = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fromSelf?@"SenderAppNodeBkg_HL":@"ReceiverTextNodeBkg" ofType:@"png"]]; UIImageView *bubbleImageView = [[UIImageView alloc] initWithImage:[bubble stretchableImageWithLeftCapWidth:floorf(bubble.size.width/2) topCapHeight:floorf(bubble.size.height/2)]]; NSLog(@"%f,%f",size.width,size.height); //添加文本信息 UILabel *bubbleText = [[UILabel alloc] initWithFrame:CGRectMake(fromSelf?15.0f:22.0f, 20.0f, size.width+10, size.height+10)]; bubbleText.backgroundColor = [UIColor clearColor]; bubbleText.font = font; bubbleText.numberOfLines = 0; bubbleText.lineBreakMode = NSLineBreakByWordWrapping; bubbleText.text = text; bubbleImageView.frame = CGRectMake(0.0f, 14.0f, bubbleText.frame.size.width+30.0f, bubbleText.frame.size.height+20.0f); if(fromSelf) returnView.frame = CGRectMake(320-position-(bubbleText.frame.size.width+30.0f), 0.0f, bubbleText.frame.size.width+30.0f, bubbleText.frame.size.height+30.0f); else returnView.frame = CGRectMake(position, 0.0f, bubbleText.frame.size.width+30.0f, bubbleText.frame.size.height+30.0f); [returnView addSubview:bubbleImageView]; [returnView addSubview:bubbleText]; return returnView; } //泡泡语音 - (UIView *)yuyinView:(NSInteger)logntime from:(BOOL)fromSelf withIndexRow:(NSInteger)indexRow withPosition:(int)position{ //根据语音长度 int yuyinwidth = 66+fromSelf; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.tag = indexRow; if(fromSelf) button.frame =CGRectMake(320-position-yuyinwidth, 10, yuyinwidth, 54); else button.frame =CGRectMake(position, 10, yuyinwidth, 54); //image偏移量 UIEdgeInsets imageInsert; imageInsert.top = -10; imageInsert.left = fromSelf?button.frame.size.width/3:-button.frame.size.width/3; button.imageEdgeInsets = imageInsert; [button setImage:[UIImage imageNamed:fromSelf?@"SenderVoiceNodePlaying":@"ReceiverVoiceNodePlaying"] forState:UIControlStateNormal]; UIImage *backgroundImage = [UIImage imageNamed:fromSelf?@"SenderVoiceNodeDownloading":@"ReceiverVoiceNodeDownloading"]; backgroundImage = [backgroundImage stretchableImageWithLeftCapWidth:20 topCapHeight:0]; [button setBackgroundImage:backgroundImage forState:UIControlStateNormal]; UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(fromSelf?-30:button.frame.size.width, 0, 30, button.frame.size.height)]; label.text = [NSString stringWithFormat:@"%d''",logntime]; label.textColor = [UIColor grayColor]; label.font = [UIFont systemFontOfSize:13]; label.textAlignment = NSTextAlignmentCenter; label.backgroundColor = [UIColor clearColor]; [button addSubview:label]; return button; } #pragma UITableView - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return _resultArray.count; } -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { NSDictionary *dict = [_resultArray objectAtIndex:indexPath.row]; UIFont *font = [UIFont systemFontOfSize:14]; CGSize size = [[dict objectForKey:@"content"] sizeWithFont:font constrainedToSize:CGSizeMake(180.0f, 20000.0f) lineBreakMode:NSLineBreakByWordWrapping]; return size.height+44; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; cell.selectionStyle = UITableViewCellSelectionStyleNone; }else{ for (UIView *cellView in cell.subviews){ [cellView removeFromSuperview]; } } NSDictionary *dict = [_resultArray objectAtIndex:indexPath.row]; //创建头像 UIImageView *photo ; if ([[dict objectForKey:@"name"]isEqualToString:@"haoning"]) { photo = [[UIImageView alloc]initWithFrame:CGRectMake(320-60, 10, 50, 50)]; [cell addSubview:photo]; photo.image = [UIImage imageNamed:@"photo1"]; if ([[dict objectForKey:@"content"] isEqualToString:@"0"]) { [cell addSubview:[self yuyinView:1 from:YES withIndexRow:indexPath.row withPosition:65]]; }else{ [cell addSubview:[self bubbleView:[dict objectForKey:@"content"] from:YES withPosition:65]]; } }else{ photo = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 50, 50)]; [cell addSubview:photo]; photo.image = [UIImage imageNamed:@"photo"]; if ([[dict objectForKey:@"content"] isEqualToString:@"0"]) { [cell addSubview:[self yuyinView:1 from:NO withIndexRow:indexPath.row withPosition:65]]; }else{ [cell addSubview:[self bubbleView:[dict objectForKey:@"content"] from:NO withPosition:65]]; } } return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { } @end
发表评论
-
facebook的socketrocket总结
2018-03-19 13:36 1379最近看了开源的网易的demo https://netease. ... -
使用websocket,双ibeacons判断方向
2014-12-16 04:08 1989只调用ibeacon的接口 // // ViewCon ... -
ios的页面跳转
2014-12-03 17:30 1336一种通过导航,一种直 ... -
打包ipa
2014-11-14 23:10 7361.新建一个文件夹命名为:Payload 2.将buid生成的 ... -
理解iOS7的Multipeer Connectivity框架
2014-11-13 23:39 882例子可跑 http://www.oschina.net/tr ... -
ios指南针
2014-10-25 17:06 1049参考http://blog.sina.com.cn/s/blo ... -
linux下编译objectc
2014-10-23 01:24 861编译静态库给ios使用 http://www.tuicool. ... -
ios加速计和陀螺仪
2014-10-22 23:03 1210ios设备中有的加速计可以测量出加速度和重力。陀螺仪可用于确定 ... -
ios仿微信的demo
2014-10-20 00:31 2299610月19日闲的蛋疼,做了个 仿微信的聊天工具 git地址:h ... -
ios8的tableView使用
2014-10-18 20:34 835ios8是main.storyboard 不是 ... -
ios的opencv的helloworld
2014-10-12 23:38 941xcode6, 学习的源码在 http://opencv.or ... -
ios opencv的一些资源
2014-10-11 00:08 775opencv for ios build http://ww ... -
ios客户端websocket的helloworld
2014-10-09 02:11 23147ios8,xcode6 https://github.com/ ... -
ios8的定位,蓝牙与ios7的区别
2014-10-06 23:27 3619以前程序的地理定位功能在iOS8 版上不能工作了(也可能其 ... -
ios的helloworld 2
2014-09-09 21:51 1267参考视频: www.imooc.com/learn/149 S ... -
ios的helloworld
2014-09-08 19:51 670参考http://www.macx.cn/thread-210 ... -
生成ipa 这个是自己总结的,ios5.1.1越狱系统,xcode4.3.3可用
2012-07-29 20:44 1948最有用的一段 export CODESIGN_ALLOCA ... -
ios上使用gcc
2012-07-18 23:21 3209安装network-cmds apptitude iphone ... -
m3u8在windows上预览
2012-06-12 14:25 6967<html> <head> ... -
cocoahttpserver
2012-03-21 22:19 1919https://github.com/robin/cocoa- ...
相关推荐
微信UI设计流程包含哪些内容呢? 一起成为高手.docx微信UI设计流程包含哪些内容呢? 一起成为高手.docx微信UI设计流程包含哪些内容呢? 一起成为高手.docx微信UI设计流程包含哪些内容呢? 一起成为高手.docx微信UI...
只注重审美,且性能高效的移动端&微信UI 只注重审美,且性能高效的移动端&微信UI 只注重审美,且性能高效的移动端&微信UI 只注重审美,且性能高效的移动端&微信UI 只注重审美,且性能高效的移动端&微信UI 只...
微信UI设计流程包含哪些内容呢? 一起成为高手.pdf微信UI设计流程包含哪些内容呢? 一起成为高手.pdf微信UI设计流程包含哪些内容呢? 一起成为高手.pdf微信UI设计流程包含哪些内容呢? 一起成为高手.pdf微信UI设计...
Android UI试练 微信UIDemo 完整的微信的UI,值得下载学习~~
企业微信UI设计XD版本weui_for_work;企业微信UI设计XD版本weui_for_work;企业微信UI设计XD版本weui_for_work;
仿微信6.0 UI界面Fragment的使用
本软件基本实现微信的所有UI效果。具备如下功能点: 登录、功能指引、退出对话框、设置界面、会话界面、右上角功能键、详细资料头像点击放大等各种功能,很完整详细的源码下载!
移动端微信UI界面ydui模板源码
Android应用源码高仿安卓微信UI项目.zip
微信ui框架,控件比较全;微信ui框架,控件比较全;微信ui框架,控件比较全;微信ui框架,控件比较全;微信ui框架,控件比较全;
高仿微信高仿微信高仿微信高仿微信高仿微信高仿微信高仿微信
android仿微信UI,很不错,值得参考学习
微信UI界面小说小程序源码
完美仿微信源码,部分功能还未实现,但是确实是不可多得的资源,值得下载!
仿微信聊天UI界面.zip,ponychatui是一个易于使用的聊天流ui库。基于AsyncDisplayKit和微信资源构建。你会发现它很像微信。
安卓 android 微信 ui 界面
高仿微信主UI
WeUI 是一套同微信原生视觉体验一致的基础样式库,由微信官方设计团队为微信内网页和微信小程序量身设计,令用户的使用感知更加统一。在微信网页或小程序中使用 WeUI 这个文档主要介绍WeUI的各个组件使用方法
webapp前端UI框架之微信UI使用教程.zip