打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
IOS上路
//
//  SelfTableView.m
//  0719-StoryBoards
//
//  Created by vigiles on 13-7-18.
//  Copyright (c) 2013年 vigiles. All rights reserved.
//
#import "SelfTableView.h"
/* -------导入数据显示视图-------- */
#import "SelfViewController.h"
@interface SelfTableView ()
@end
@implementation SelfTableView
/* 表格长度。即有多少行单元格 */
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}
/* 初始化单元格内容 */
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //标示符,要在故事板中和表单控件的单元格关联
    NSString * indentifier = @"Cell";
     
    //声明可重用单元格
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:indentifier];
    //分配内存,初始化
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indentifier];
    }
    //文本内容
    cell.textLabel.text = [NSString stringWithFormat:@"%d", indexPath.row];
     
    return cell;
}
/* 获取点击的单元格 */
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    NSIndexPath * indexPath = [self.tableView indexPathForCell:sender];
     
    /* ----------操作数据显示视图---------- */
    SelfViewController * svc = segue.destinationViewController;
     
    svc.strData = [NSString stringWithFormat:@"%d", indexPath.row];
}
@end
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
UITableVIewCell自动适应高度
TableVIew
如何在UINavigationBar上添加UISearchBar以及UISearchDisplayController的使用 OC iOS
关于tableviewcell addsubview的重叠问题 | iOS开发
IOS的TableViewCell会重叠的问题
tableview中cell的设置
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服