首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

数据绑定UITableView变全屏了,如何不让它变成全屏

2013-12-29 
数据绑定UITableView变全屏了,怎么不让它变成全屏数据绑定UITableView变全屏了,怎么不让它变成全屏!我的代

数据绑定UITableView变全屏了,怎么不让它变成全屏
数据绑定UITableView变全屏了,怎么不让它变成全屏!
我的代码如下:
@synthesize myTableView;
NSMutableArray *ds;

- (void)viewDidLoad
{
    [super viewDidLoad];

    ds=[[NSMutableArray alloc] init];
    [ds addObject:@"1"];
    [ds addObject:@"2"];
    [ds addObject:@"3"];
    [ds addObject:@"4"];
    [ds addObject:@"5"];
    
    UITableView *tableView =[[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStylePlain];
    tableView.dataSource= self;
    tableView.delegate=self;
    self.myTableView =tableView;
    [self.view addSubview:myTableView];
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier =@"cell";
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell==nil)
    {
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }
    
    NSString *cellValue =[ds objectAtIndex:indexPath.row];
    cell.textLabel.text=cellValue;
    return cell;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return ds.count;
}

热点排行