【发布时间】:2015-02-17 06:45:06
【问题描述】:
我的问题是我想仅使用一个原型单元格在标签值中显示数组元素,但我得到的是这个
这是我的代码。有人可以帮我吗? 对不起,我的英语不好。 :)
- (void)viewDidLoad {
[super viewDidLoad];
self.imgProfilePic.layer.cornerRadius = self.imgProfilePic.bounds.size.width/2;
self.imgProfilePic.layer.masksToBounds = YES;
self.lblBadge.layer.cornerRadius = self.lblBadge.bounds.size.width/2;
self.lblBadge.layer.masksToBounds = YES;
self.userData = [NSMutableArray arrayWithObjects:@"Projects",@"Tags",@"Saved Searches",@"Filters",@"Groups",@"Users",@"Settings",@"Abouts Us", nil];
}
- (void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [self.userData count];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
NSString *identifier = @"myCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
cell.textLabel.text = [self.userData objectAtIndex:indexPath.row];
return cell;
}
【问题讨论】:
-
这里提供链接,我会上传...
-
那么问题出在哪里?看不到您上传的图片。
-
cell.textLabel.numberoflines = 0;
-
@FahimParkar 现在不需要上传,我自己解决了。 :)
标签: objective-c uitableview ios7 custom-cell