CN104636136A - 基于iOS系统中UITableView类型Plain模拟Group的方法 - Google Patents

基于iOS系统中UITableView类型Plain模拟Group的方法 Download PDF

Info

Publication number
CN104636136A
CN104636136A CN201510012786.3A CN201510012786A CN104636136A CN 104636136 A CN104636136 A CN 104636136A CN 201510012786 A CN201510012786 A CN 201510012786A CN 104636136 A CN104636136 A CN 104636136A
Authority
CN
China
Prior art keywords
tableview
uitableview
view
sectionview
section
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510012786.3A
Other languages
English (en)
Other versions
CN104636136B (zh
Inventor
沈文策
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Financial Technology Co., Ltd.
Original Assignee
沈文策
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 沈文策 filed Critical 沈文策
Priority to CN201510012786.3A priority Critical patent/CN104636136B/zh
Publication of CN104636136A publication Critical patent/CN104636136A/zh
Application granted granted Critical
Publication of CN104636136B publication Critical patent/CN104636136B/zh
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

本发明提供一种基于iOS系统中UITableView类型Plain模拟Group的方法,创建UITableView的类型为Plain,并创建一个视图控制器;在视图控制器上加载tableView,为该tableView创建至少一个区;创建一视图,并将该视图加载至每个所述区中,并定义该视图的tableView和section两个属性,重写setFrame方法;在视图控制器中重写tableView:viewForHeaderInSection:方法,即可完成模拟Group,使得用户客观区域变大。

Description

基于iOS系统中UITableView类型Plain模拟Group的方法
技术领域
本发明涉及一种基于iOS系统中UITableView类型Plain模拟Group的方法。
背景技术
自从Apple公司推出iOS7系统,系统风格扁平化.对于UITableView这个控件,开发者有时在处理多Section时,要求滑动的风格能像UITableView的Plain风格一样,它的Section能够不贴在视图的最上层,这样整个手机屏幕能够给用户更大的区域来显示内容,但是iOS系统,无论是iOS6,还是iOS7都没有这样的效果。
发明内容
本发明要解决的技术问题,在于提供一种基于iOS系统中UITableView类型Plain模拟Group的方法,使得用户客观区域变大。
本发明是这样实现的:一种基于iOS系统中UITableView类型Plain模拟Group的方法,包括如下步骤:
步骤1、创建UITableView的类型为Plain,并创建一个视图控制器;
步骤2、在视图控制器上加载tableView,为该tableView创建至少一个区;
步骤3、创建一视图,并将该视图加载至每个所述区中,并定义该视图的tableView和section两个属性,重写setFrame方法;
步骤4、在视图控制器中重写tableView:viewForHeaderInSection:方法,即可完成模拟Group。
进一步地,所述步骤3中重写setFrame方法为:
-(void)setFrame:(CGRect)frame{CGRect sectionRect=[self.tableViewrectForSection:self.section];CGRectnewFrame=CGRectMake(CGRectGetMinX(frame),CGRectGetMinY(sectionRect),CGRectGetWidth(frame),CGRectGetHeight(frame));[super setFrame:newFrame];}。
进一步地,所述步骤4中重写tableView:viewForHeaderInSection:方法为:
SectionView*sectionView=[[SectionViewalloc]init];
sectionView.tableView=self.tableView;sectionView.section=section;
return sectionView;
本发明具有如下优点:本发明一种基于iOS系统中UITableView类型Plain模拟Group的方法通过该方法实现Section的不浮动,使得UITableView的滑动效果更加美观,而且在开发App的过程中,使得用户在手机上的可视区域变大,能够使用户感到简单大方同时获取更多的视觉空间,使App的交互更加人性化。
附图说明
下面参照附图结合实施例对本发明作进一步的说明。
图1为本发明方法执行流程图。
具体实施方式
如图1所示,基于iOS系统中UITableView类型Plain模拟Group的方法,包括如下步骤:
步骤1、创建UITableView的类型为Plain,并创建一个视图控制器;
步骤2、在视图控制器上加载tableView,为该tableView创建至少一个区;
步骤3、创建一视图,并将该视图加载至每个所述区中,并定义该视图的tableView和section两个属性,重写setFrame方法:
-(void)setFrame:(CGRect)frame{CGRect sectionRect=[self.tableViewrectForSection:self.section];CGRectnewFrame=CGRectMake(CGRectGetMinX(frame),CGRectGetMinY(sectionRect),CGRectGetWidth(frame),CGRectGetHeight(frame));[super setFrame:newFrame];};
步骤4、在视图控制器中重写tableView:viewForHeaderInSection:方法:
SectionView*sectionView=[[SectionViewalloc]init];
sectionView.tableView=self.tableView;sectionView.section=section;
return sectionView;
,即可完成模拟Group。
本发明一具体实施例如下:
对于UITableView这个控件来说,一般来说肯定是上下滑动的,首先创建UITableView的类型为Plain,然后发现UITableView的它的Section实际上也是一个试图(UIView),而且UITableView也有自定义Section的方法,即:tableView:viewForHeaderInSection:。在这个方法中我们创建一个试图,把它加载到UITableView的Section上。然后在TableView滑动的过程中,我们时刻检测Section的出现在的区域在父试图的大小,CGRectGetMinY和CGRectGetMinX来获取Section大小,然后改变Section的大小,这样给我的视觉效果就是UITableView的Section在上下滑动,具体如下:
在Xcode软件中创建一个新工程(Project),创建一个视图控制器(UIViewController),在这个视图控制器上加载一个tableView,为这个tableView创建多个区(Section),每个区的行数(Row)不限。然后创建一个视图(UIView)Sectionview,在SectionView中定义两个属性tableView和section,在SectionView中重写setFrame:方法如下:
-(void)setFrame:(CGRect)frame{CGRect sectionRect=[self.tableViewrectForSection:self.section];CGRectnewFrame=CGRectMake(CGRectGetMinX(frame),CGRectGetMinY(sectionRect),CGRectGetWidth(frame),CGRectGetHeight(frame));[super setFrame:newFrame];}
然后在视图控制器里面重写tableView:viewForHeaderInSection:方法,里面写代码如下:
SectionView*sectionView=[[SectionViewalloc]init];
sectionView.tableView=self.tableView;sectionView.section=section;
return sectionView;
1.CGRectGetMinX方法的作用得到目前scrollview在当前屏幕中相对于整个UIScrollView的最小值(位于屏幕的最左边)
2.CGRectGetMaxX方法的作用得到目前scrollview在当前屏幕中相对于整个UIScrollView的最大值(位于屏幕的最右边)
3.CGRectGetMinY方法的作用得到目前scrollview在当前屏幕中相对于整个UIScrollView的最小值(位于屏幕的最上边)
4.CGRectGetMaxY方法的作用得到目前scrollview在当前屏幕中相对于整个UIScrollView的最大值(位于屏幕的最下边)
虽然以上描述了本发明的具体实施方式,但是熟悉本技术领域的技术人员应当理解,我们所描述的具体的实施例只是说明性的,而不是用于对本发明的范围的限定,熟悉本领域的技术人员在依照本发明的精神所作的等效的修饰以及变化,都应当涵盖在本发明的权利要求所保护的范围内。

Claims (3)

1.一种基于iOS系统中UITableView类型Plain模拟Group的方法,其特征在于:包括如下步骤:
步骤1、创建UITableView的类型为Plain,并创建一个视图控制器;
步骤2、在视图控制器上加载tableView,为该tableView创建至少一个区;
步骤3、创建一视图,并将该视图加载至每个所述区中,并定义该视图的tableView和section两个属性,重写setFrame方法;
步骤4、在视图控制器中重写tableView:viewForHeaderInSection:方法,即可完成模拟Group。
2.根据权利要求1所述的基于iOS系统中UITableView类型Plain模拟Group的方法,其特征在于:所述步骤3中重写setFrame方法为:
-(void)setFrame:(CGRect)frame{CGRect sectionRect=[self.tableViewrectForSection:self.section];CGRectnewFrame=CGRectMake(CGRectGetMinX(frame),CGRectGetMinY(sectionRect),CGRectGetWidth(frame),CGRectGetHeight(frame));[super setFrame:newFrame];}。
3.根据权利要求2所述的基于iOS系统中UITableView类型Plain模拟Group的方法,其特征在于:所述步骤4中重写tableView:viewForHeaderInSection:方法为:
SectionView*sectionView=[[SectionViewalloc]init];
sectionView.tableView=self.tableView;sectionView.section=section;
return sectionView;
CN201510012786.3A 2015-01-12 2015-01-12 基于iOS系统中UITableView类型Plain模拟Group的方法 Active CN104636136B (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510012786.3A CN104636136B (zh) 2015-01-12 2015-01-12 基于iOS系统中UITableView类型Plain模拟Group的方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510012786.3A CN104636136B (zh) 2015-01-12 2015-01-12 基于iOS系统中UITableView类型Plain模拟Group的方法

Publications (2)

Publication Number Publication Date
CN104636136A true CN104636136A (zh) 2015-05-20
CN104636136B CN104636136B (zh) 2018-06-08

Family

ID=53214937

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510012786.3A Active CN104636136B (zh) 2015-01-12 2015-01-12 基于iOS系统中UITableView类型Plain模拟Group的方法

Country Status (1)

Country Link
CN (1) CN104636136B (zh)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677366A (zh) * 2016-02-26 2016-06-15 四川长虹电器股份有限公司 基于iOS系统中UITableView实现无限循环滚动选择的方法
CN106502656A (zh) * 2016-10-09 2017-03-15 武汉斗鱼网络科技有限公司 一种ios系统中列表视图构建方法及系统
CN106815015A (zh) * 2016-12-21 2017-06-09 武汉斗鱼网络科技有限公司 一种ios中视图组织方法及系统
CN106843992A (zh) * 2016-12-22 2017-06-13 武汉斗鱼网络科技有限公司 数据管理方法及装置
CN107066178A (zh) * 2017-01-23 2017-08-18 山东浪潮商用系统有限公司 一种实现手机app列表动画展现的方法
CN108614739A (zh) * 2016-12-12 2018-10-02 阿里巴巴集团控股有限公司 一种传递消息的方法及装置

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060044741A1 (en) * 2004-08-31 2006-03-02 Motorola, Inc. Method and system for providing a dynamic window on a display
CN103473041A (zh) * 2013-07-12 2013-12-25 西北工业大学 一种可视化的数据处理方法及系统

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060044741A1 (en) * 2004-08-31 2006-03-02 Motorola, Inc. Method and system for providing a dynamic window on a display
CN103473041A (zh) * 2013-07-12 2013-12-25 西北工业大学 一种可视化的数据处理方法及系统

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
晓哲: ""UITableView的使用大全"", 《百度文库》 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677366A (zh) * 2016-02-26 2016-06-15 四川长虹电器股份有限公司 基于iOS系统中UITableView实现无限循环滚动选择的方法
CN105677366B (zh) * 2016-02-26 2019-01-11 四川长虹电器股份有限公司 基于iOS系统中UITableView实现无限循环滚动选择的方法
CN106502656A (zh) * 2016-10-09 2017-03-15 武汉斗鱼网络科技有限公司 一种ios系统中列表视图构建方法及系统
CN106502656B (zh) * 2016-10-09 2018-08-03 武汉斗鱼网络科技有限公司 一种ios系统中列表视图构建方法及系统
CN108614739A (zh) * 2016-12-12 2018-10-02 阿里巴巴集团控股有限公司 一种传递消息的方法及装置
CN106815015A (zh) * 2016-12-21 2017-06-09 武汉斗鱼网络科技有限公司 一种ios中视图组织方法及系统
CN106843992A (zh) * 2016-12-22 2017-06-13 武汉斗鱼网络科技有限公司 数据管理方法及装置
CN107066178A (zh) * 2017-01-23 2017-08-18 山东浪潮商用系统有限公司 一种实现手机app列表动画展现的方法

Also Published As

Publication number Publication date
CN104636136B (zh) 2018-06-08

Similar Documents

Publication Publication Date Title
CN104636136A (zh) 基于iOS系统中UITableView类型Plain模拟Group的方法
US11910871B2 (en) Footwear designing tool
KR102186865B1 (ko) 컨트롤 및 파트 부합 계층구조
JP2015512078A5 (zh)
US9946806B2 (en) Exporting responsive designs from a graphical design tool
US11449314B2 (en) Rapid application development method
CN104050274A (zh) 一种html页面嵌套方法及装置
CN103473041B (zh) 一种可视化的数据处理方法及系统
CN104077114A (zh) 一种更换应用软件的显示界面的方法及电子设备
CN108399183A (zh) 基于Excel系统界面的数据库联动方法、电子装置及存储介质
de Melo et al. CFD as a tool for pumping strategy evaluation on matrix acidizing treatments
CN108228036B (zh) 一种windows中窗口菜单的实现方法及装置
TW201913351A (zh) 視圖組件的佈局方法及設備
KR20150085869A (ko) 계층형 구조 및 타임라인을 이용한 앱북 빌더 시스템
CN104050150B (zh) 用于在图表中组织对象和联系的方法和系统
CN112306616B (zh) 一种加载显示处理方法、装置、计算机设备和存储介质
Watanobe et al. Information resources of* AIDA programs
CN106293411A (zh) 一种控件展示方法及装置
Bakir et al. User Interface Development with Xcode 6
CN104407868A (zh) 一种组织机构图的实现方法及装置
Dale et al. Improving visualization of large scale reservoir models
Cannaerts Future Vision Exhibition: Artificial Landscapes
US10437940B2 (en) Computational design of linkage-based characters
Jackson et al. Android UI Layout Conventions, Differences and Approaches
Ike et al. Rim oil economic maximum efficient rate and reserve potential evaluation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20180911

Address after: 100020 15 Guanghua Road, Chaoyang District, Beijing, 15A6 15

Patentee after: Beijing Financial Technology Co., Ltd.

Address before: 350000 Fuzhou, Fujian, Gulou District, Fuzhou, 66 West River Binhai Road, No. 66, 7 B

Patentee before: Shen Wence