当前位置: 首页 > news >正文

家装网站网站专题建设

家装网站,网站专题建设,网站租空间多少钱一年,做网站 阿里云和百度云哪个好一、简单介绍 xib和storyboard的比较#xff0c;一个轻量级一个重量级。 共同点#xff1a; 都用来描述软件界面 都用Interface Builder工具来编辑 不同点: Xib是轻量级的#xff0c;用来描述局部的UI界面 Storyboard是重量级的#xff0c;用来描述整个软件的多个界面…一、简单介绍 xib和storyboard的比较一个轻量级一个重量级。 共同点 都用来描述软件界面 都用Interface Builder工具来编辑 不同点: Xib是轻量级的用来描述局部的UI界面 Storyboard是重量级的用来描述整个软件的多个界面并且能展示多个界面之间的跳转关系 二、xib的简单使用 1.建立xib文件 建立的xib文件命名为appxib.xib 2.对xib进行设置   根据程序的需要这里把view调整为自由布局 建立view模型设置长宽等参数 调整布局和内部的控件   完成后的单个view 3.使用xib文件的代码示例 YYViewController.m文件代码如下 1 //2 // YYViewController.m3 // 10-xib文件的使用4 //5 // Created by apple on 14-5-24.6 // Copyright (c) 2014年 itcase. All rights reserved.7 //8 9 #import YYViewController.h 10 #import YYapp.h 11 12 interface YYViewController () 13 property(nonatomic,strong)NSArray *app; 14 end 15 16 implementation YYViewController 17 18 //1.加载数据信息 19 -(NSArray *)app 20 { 21 if (!_app) { 22 NSString *path[[NSBundle mainBundle]pathForResource:app.plist ofType:nil]; 23 NSArray *temparray[NSArray arrayWithContentsOfFile:path]; 24 25 //字典转模型 26 NSMutableArray *arrayM[NSMutableArray array ]; 27 for (NSDictionary *dict in temparray) { 28 [arrayM addObject:[YYapp appWithDict:dict]]; 29 } 30 _apparrayM; 31 } 32 return _app; 33 } 34 35 //创建界面原型 36 - (void)viewDidLoad 37 { 38 [super viewDidLoad]; 39 NSLog(%d,self.app.count); 40 41 //九宫格布局 42 int totalloc3; 43 CGFloat appviewW80; 44 CGFloat appviewH90; 45 CGFloat margin(self.view.frame.size.width-totalloc*appviewW)/(totalloc1); 46 47 int countself.app.count; 48 for (int i0; icount; i) { 49 50 int rowi/totalloc; 51 int loci%totalloc; 52 CGFloat appviewXmargin (margin appviewW)*loc; 53 CGFloat appviewYmargin (margin appviewH)*row; 54 YYapp *appself.app[i]; 55 56 //拿出xib视图 57 NSArray *apparray [[NSBundle mainBundle]loadNibNamed:appxib owner:nil options:nil]; 58 UIView *appview[apparray firstObject]; 59 //加载视图 60 appview.frameCGRectMake(appviewX, appviewY, appviewW, appviewH); 61 62 UIImageView *appviewImg(UIImageView *)[appview viewWithTag:1]; 63 appviewImg.imageapp.image; 64 65 UILabel *appviewlab(UILabel *)[appview viewWithTag:2]; 66 appviewlab.textapp.name; 67 68 UIButton *appviewbtn(UIButton *)[appview viewWithTag:3]; 69 [appviewbtn addTarget:self action:selector(appviewbtnClick:) forControlEvents:UIControlEventTouchUpInside]; 70 appviewbtn.tagi; 71 72 [self.view addSubview:appview]; 73 } 74 } 75 76 /**按钮的点击事件*/ 77 -(void)appviewbtnClick:(UIButton *)btn 78 { 79 YYapp *appsself.app[btn.tag]; 80 UILabel *showlab[[UILabel alloc]initWithFrame:CGRectMake(60, 450, 200, 20)]; 81 [showlab setText:[NSString stringWithFormat: %下载成功,apps.name]]; 82 [showlab setBackgroundColor:[UIColor lightGrayColor]]; 83 [self.view addSubview:showlab]; 84 showlab.alpha1.0; 85 86 //简单的动画效果 87 [UIView animateWithDuration:2.0 animations:^{ 88 showlab.alpha0; 89 } completion:^(BOOL finished) { 90 [showlab removeFromSuperview]; 91 }]; 92 } 93 94 end   运行效果 三、对xib进行连线示例 1.连线示例 新建一个xib对应的视图类继承自Uiview   在xib界面右上角与新建的视图类进行关联 把xib和视图类进行连线 2.连线后的代码示例 YYViewController.m文件代码如下 1 //2 // YYViewController.m3 // 10-xib文件的使用4 //5 // Created by apple on 14-5-24.6 // Copyright (c) 2014年 itcase. All rights reserved.7 //8 9 #import YYViewController.h 10 #import YYapp.h 11 #import YYappview.h 12 13 interface YYViewController () 14 property(nonatomic,strong)NSArray *app; 15 end 16 17 implementation YYViewController 18 19 //1.加载数据信息 20 -(NSArray *)app 21 { 22 if (!_app) { 23 NSString *path[[NSBundle mainBundle]pathForResource:app.plist ofType:nil]; 24 NSArray *temparray[NSArray arrayWithContentsOfFile:path]; 25 26 //字典转模型 27 NSMutableArray *arrayM[NSMutableArray array ]; 28 for (NSDictionary *dict in temparray) { 29 [arrayM addObject:[YYapp appWithDict:dict]]; 30 } 31 _apparrayM; 32 } 33 return _app; 34 } 35 36 //创建界面原型 37 - (void)viewDidLoad 38 { 39 [super viewDidLoad]; 40 NSLog(%d,self.app.count); 41 42 //九宫格布局 43 int totalloc3; 44 CGFloat appviewW80; 45 CGFloat appviewH90; 46 CGFloat margin(self.view.frame.size.width-totalloc*appviewW)/(totalloc1); 47 48 int countself.app.count; 49 for (int i0; icount; i) { 50 51 int rowi/totalloc; 52 int loci%totalloc; 53 CGFloat appviewXmargin (margin appviewW)*loc; 54 CGFloat appviewYmargin (margin appviewH)*row; 55 YYapp *appself.app[i]; 56 57 //拿出xib视图 58 NSArray *apparray [[NSBundle mainBundle]loadNibNamed:appxib owner:nil options:nil]; 59 60 //注意这里的类型名! 61 //UIView *appview[apparray firstObject]; 62 YYappview *appview[apparray firstObject]; 63 64 //加载视图 65 appview.frameCGRectMake(appviewX, appviewY, appviewW, appviewH); 66 [self.view addSubview:appview]; 67 68 appview.appimg.imageapp.image; 69 appview.applab.textapp.name; 70 appview.appbtn.tagi; 71 72 [ appview.appbtn addTarget:self action:selector(appviewbtnClick:) forControlEvents:UIControlEventTouchUpInside]; 73 74 } 75 } 76 77 /**按钮的点击事件*/ 78 -(void)appviewbtnClick:(UIButton *)btn 79 { 80 YYapp *appsself.app[btn.tag]; 81 UILabel *showlab[[UILabel alloc]initWithFrame:CGRectMake(60, 450, 200, 20)]; 82 [showlab setText:[NSString stringWithFormat: %下载成功,apps.name]]; 83 [showlab setBackgroundColor:[UIColor lightGrayColor]]; 84 [self.view addSubview:showlab]; 85 showlab.alpha1.0; 86 87 //简单的动画效果 88 [UIView animateWithDuration:2.0 animations:^{ 89 showlab.alpha0; 90 } completion:^(BOOL finished) { 91 [showlab removeFromSuperview]; 92 }]; 93 } 94 95 end YYappview.h文件代码已经连线 #import UIKit/UIKit.hinterface YYappview : UIView property (weak, nonatomic) IBOutlet UIImageView *appimg; property (weak, nonatomic) IBOutlet UILabel *applab; property (weak, nonatomic) IBOutlet UIButton *appbtn; end  转载于:https://www.cnblogs.com/zengshuilin/p/5740689.html
http://www.sadfv.cn/news/57547/

相关文章:

  • wordpress 插件站建设刷会员网站
  • 什么是网站app网站开发流程步骤 口袋
  • 滨州网站建设wordpress有什么用处
  • 网站建设开票应该开哪个行业专业的大良网站设计
  • 一学一做教育视频网站有哪些区块链开发平台有哪些
  • 公司业绩怎么发到建设厅网站上dw手机版下载安装
  • 建德营销型网站建设wordpress编辑器自定义按钮
  • 网站优化的好处域名到网站上线
  • 福州网站开发风格织梦如何做几种语言的网站
  • 上海的建设网站首页python编程软件安装教程
  • 单位建设网站注意点新蔡县做网站收多少钱
  • 家装设计方案ppt案例温州优化网站方法
  • 四川省建设厅招投标网站百度网址提交
  • 怎么做免费网站教程太平保险网站
  • 方便做流程图的网站怎么建立网站 个人
  • 铜仁建设厅官方网站南京的网站建设
  • 界面 网站如何发布一个自己的网站
  • 外贸人最常用的网站市场采购贸易平台
  • 网站建设这方面的钱站网站如何
  • 网站建设丶金手指花总12网络营销的特点是
  • 教育集团网站建设河南卫生基层系统网站建设
  • 优购物官方网站手机版徐州seo排名收费
  • 网站发展趋势和前景wordpress登陆密码
  • 如何获取网站js图片合肥住房和建设厅网站首页
  • 乌市地区建设工程门户网站广东网站制作公司
  • 无忧中英繁企业网站系统通用版上海进出口贸易公司有哪些
  • 网站后台系统有哪些昆山网站建设多少钱
  • 输入一组基因做网络图的网站网站建设结论与改进
  • 网站建设seo运营规划销售网站的销量统计怎么做
  • 洛阳建站优化教程哪个网站用户体验较好