
StoryBoard里面怎么去用自定义得UITableViewCell
2个回答
2016-01-17 · 查话费、办靓号、装宽带,尽在中国电信!

中国电信网上营业厅一直坚持以满足客户需求和全方位提升客户服务为根本,不断追求产品的完善与创新,向您提供费用查询、充值交费、买手机、办靓号、装宽带、积分兑换等差异化服务。
向TA提问
关注

展开全部
一、如何使用storyboard简单实现UITableViewCell页面,步骤如下:
1、创建一个带有storyboard的singleview application应用程序如图。
创建好的应用程序已经自动创建好了一个和MainStoryboard连接好的ViewController。
2、在MainStoryboard中,选中ViewController并拖入tableview以及tableviewCell,并且设置tableviewCell的style为Basic,Identifier为Cell,如果希望是自定义cell的则需要选择custom,如下图,之后可以插入一个NavigationController:
现在可以编码了,在ViewController.m中:
#pragmamark - UITableViewDataSource
-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{
return1;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
staticNSString*CellIdentifier = @"Cell";
UITableViewCell*cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell= [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
cell.textLabel.text=@"话题";
returncell;
}
即可。
1、创建一个带有storyboard的singleview application应用程序如图。
创建好的应用程序已经自动创建好了一个和MainStoryboard连接好的ViewController。
2、在MainStoryboard中,选中ViewController并拖入tableview以及tableviewCell,并且设置tableviewCell的style为Basic,Identifier为Cell,如果希望是自定义cell的则需要选择custom,如下图,之后可以插入一个NavigationController:
现在可以编码了,在ViewController.m中:
#pragmamark - UITableViewDataSource
-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{
return1;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
staticNSString*CellIdentifier = @"Cell";
UITableViewCell*cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell= [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
cell.textLabel.text=@"话题";
returncell;
}
即可。

2023-12-06 广告
UIkit是一套轻量级、模块化且易于使用的开源UI组件库,由YOOtheme团队开发。它提供了丰富的界面元素,包括按钮、表单、表格、对话框、滑块、下拉菜单、选项卡等等,适用于各种类型的网站和应用程序。UIkit还支持响应式设计,可以根据不同...
点击进入详情页
本回答由网易云信提供
展开全部
一、如何使用storyboard简单实现Push页面,步骤如下:
1、创建一个带有storyboard的singleview application应用程序如图。
创建好的应用程序已经自动创建好了一个和MainStoryboard连接好的ViewController。
2、在MainStoryboard中,选中ViewController并拖入tableview以及tableviewCell,并且设置tableviewCell的style为Basic,Identifier为Cell,如果希望是自定义cell的则需要选择custom,如下图,之后可以插入一个NavigationController:
现在可以编码了,在ViewController.m中:
#pragmamark - UITableViewDataSource
-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{
return1;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
staticNSString*CellIdentifier = @"Cell";
UITableViewCell*cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell= [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
cell.textLabel.text=@"话题";
returncell;
}
1、创建一个带有storyboard的singleview application应用程序如图。
创建好的应用程序已经自动创建好了一个和MainStoryboard连接好的ViewController。
2、在MainStoryboard中,选中ViewController并拖入tableview以及tableviewCell,并且设置tableviewCell的style为Basic,Identifier为Cell,如果希望是自定义cell的则需要选择custom,如下图,之后可以插入一个NavigationController:
现在可以编码了,在ViewController.m中:
#pragmamark - UITableViewDataSource
-(NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section{
return1;
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath{
staticNSString*CellIdentifier = @"Cell";
UITableViewCell*cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil)
{
cell= [[UITableViewCellalloc]initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
}
cell.textLabel.text=@"话题";
returncell;
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询