【发布时间】:2012-10-08 16:41:38
【问题描述】:
我有一个 UITableView,在 -(void)ViewDidLoad 中有一些数据。所以它相应地出现。但是当我点击一个按钮时,我的 tableview 应该被隐藏,我应该加载一个带有一些文本的 UIlabel。
但对我来说,在按钮上单击带有一些行的空表视图正在加载。我应该避免它。我该怎么做?
这是我的代码
-(void)ViewDidLoad {
tableView=[[UITableView alloc]initWithFrame:CGRectMake(0,380,320,200) style:UITableViewStylePlain];
tableView.delegate = self;
tableView.dataSource = self;
[self.view addSubview:tableView];
}
-(void)DatePickerDoneClick:(id)sender {
[tableview setHidden:YES];
displayError =[[UILabel alloc]init];
[displaytError setFrame:CGRectMake(20,400,320,100)];
displayError.textAlignment=UITextAlignmentLeft;
displayError.backgroundColor=[UIColor clearColor];
displayError.text=[NSString stringWithFormat:@"Not found"];
[self.view addSubview:displayError];
}
不知道哪里出错了?
【问题讨论】:
-
[tableview setHidden:YES];更正这一行并进行测试。
标签: iphone uitableview xcode4