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

网站建设近义词/简述网站推广的意义和方法

网站建设近义词,简述网站推广的意义和方法,深圳响应式网站开发,动态网站建设编程最近手上任务比较轻,打算把一些之前做一些的简单的东西再整理整理,优化一下,做个记录; TableView的折叠拉伸主要是在一些联系人分组里会经常见到,今天做了一个简单的demo,代码也做了处理,随拿随…

最近手上任务比较轻,打算把一些之前做一些的简单的东西再整理整理,优化一下,做个记录; 

TableView的折叠拉伸主要是在一些联系人分组里会经常见到,今天做了一个简单的demo,代码也做了处理,随拿随用。

思路整理:

1.根据数据设置分组

2.设置折叠/拉伸状态标识

3.实现分组透视图点击事件

实现代码:

#import "FoldTableViewController.h"

#define STATE @"state"

#define INFO @"info"

@interface FoldTableViewController ()

{

NSMutableArray *_dataArray;//数据源数组

}

@end

@implementation FoldTableViewController

- (void)viewDidLoad {

[super viewDidLoad];

[self setExtraCellLineHidden];

[self requestData];

}

//底部视图留白

- (void)setExtraCellLineHidden{

UIView *view = [UIView new];

view.backgroundColor = [UIColor clearColor];

[self.tableView setTableFooterView:view];

}

//创建数据

- (void)requestData{

/**

假设有i组数据,每组有j条内容:

每组实例化一个可变字典存储组内数据,STATE对应当前状态(折叠/拉伸),INFO对应当前内容;

*/

_dataArray = [[NSMutableArray alloc]init];

for (int i = 0; i < 5; i++) {

NSMutableDictionary *tempDict = [[NSMutableDictionary alloc]init];

NSMutableArray *tempArr = [[NSMutableArray alloc]init];

for (int j = 0; j < 10; j++) {

NSString *infoStr = [NSString stringWithFormat:@"test%d",j];

[tempArr addObject:infoStr];

}

[tempDict setValue:@"1" forKey:STATE];

[tempDict setValue:tempArr forKey:INFO];

[_dataArray addObject:tempDict];

}

}

- (void)didReceiveMemoryWarning {

[super didReceiveMemoryWarning];

// Dispose of any resources that can be recreated.

}

#pragma mark - Table view data source

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

return _dataArray.count;

}

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

NSString *state = _dataArray[section][STATE];

if ([state isEqualToString:@"0"]) {

return 0;

}

return [_dataArray[section][@"info"] count];

}

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

static NSString *ide = @"myCell";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ide];

if (!cell) {

cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ide];

}

//取到当前cell的内容

cell.textLabel.text = _dataArray[indexPath.section][@"info"][indexPath.row];

return cell;

}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{

UIView *headView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KScreenWidth, 20)];

headView.tag = 10+section;

headView.backgroundColor = [UIColor grayColor];

UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 20, 20)];

[headView addSubview:imageView];

UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(40, 5, 100, 20)];

titleLabel.text = [NSString stringWithFormat:@"section%ld",section];

titleLabel.textColor = [UIColor whiteColor];

[headView addSubview:titleLabel];

/**在刷新视图时,根据当前分组的状态,调整头视图的内容视图

*/

NSDictionary *dict = _dataArray[section];

if ([dict[STATE] isEqualToString:@"1"]) {

imageView.image = [UIImage imageNamed:@"arrow_spread"];

}else{

imageView.image = [UIImage imageNamed:@"arrow_fold"];

}

/**为头视图添加轻触事件

*/

UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(headViewClick:)];

[headView addGestureRecognizer:tap];

return headView;

}

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

return 30;

}

- (void)headViewClick:(UITapGestureRecognizer *)tap{

NSInteger index = tap.view.tag-10;

NSMutableDictionary *dict = _dataArray[index];

/**点击头视图,改变该组状态

*/

if ([dict[STATE] isEqualToString:@"1"]) {

[dict setValue:@"0" forKey:STATE];

}else{

[dict setValue:@"1" forKey:STATE];

}

/**刷新当前点击分组的数据

reloadSections:需要刷新的分组

withRowAnimation:刷新的动画方式

*/

[self.tableView reloadSections:[NSIndexSet indexSetWithIndex:index] withRowAnimation:UITableViewRowAnimationNone];

}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

[tableView deselectRowAtIndexPath:indexPath animated:YES];

}

转载于:https://juejin.im/post/5a31d4d451882526151a9ac2

http://www.lbrq.cn/news/947557.html

相关文章:

  • 学做网站要代码/dz论坛如何seo
  • 做网站教程流程/快速排名seo软件
  • 菏泽机关建设网站/河南品牌网站建设
  • 新时代文明实践站模板/如何网站seo
  • 网站设计高端网站制作/怎样才能在百度上面做广告宣传
  • 建设网站的视频/关键词优化技巧
  • 网站怎么做自营销/求网址
  • 网站管理有哪些/引流推广平台有哪些
  • 桂林网站开发公司/b站引流推广
  • 在网站上显示备案信息/建站模板网站
  • 门户网站开发的意义/个人微信管理系统
  • wordpress站点打不开/重庆seo整站优化外包服务
  • vue.js做网站/seo测试工具
  • 石家庄哪里可以做网站/如何建立一个网站
  • 专门做地图的网站/长沙靠谱关键词优化公司电话
  • wordpress主题里加广告/优化大师电脑版官方
  • 泉州 网站制作/济南seo排名搜索
  • 网站抬头怎么做/百度网址大全 官网
  • 建设网站开发的语言有哪些/电商中seo是什么意思
  • asp做的网站如何更新/百度广告怎么做
  • 深圳政府招聘信息网站/网站模板免费
  • 广西建设职业技术学院官网/夫唯老师seo
  • 做国外有那些网站/seo网络推广报价
  • php网站开发实例教程书/互联网行业最新资讯
  • 网站开发一般要哪些开发工具/爱站网域名查询
  • oa系统登录界面/苏州seo网络推广
  • paypal可做网站/百度seo优化排名软件
  • 触屏版网站css/网站seo优化服务商
  • 六安新闻网新闻头条/甘肃seo技术
  • 住房和城乡建设网站 上海/免费信息发布平台网站
  • 【集合】JDK1.8 HashMap 底层数据结构深度解析
  • SqlRest让SQL秒变Http API,还支持20+数据库(含国产数据库)
  • LeetCode 23:合并 K 个升序链表
  • Compose 适配 - 键鼠模式
  • 五、Vue项目开发流程
  • Unity × RTMP × 头显设备:打造沉浸式工业远控视频系统的完整方案