2015-02-17 1 views
0

моя проблема в том, что я хочу, чтобы отобразить элементы массива значений меток, используя только один прототип клетки, но то, что я получаю этоTableview Пользовательские ячейки mutliple значения на одной этикетке

И вот мой код. Может кто-нибудь, пожалуйста, помогите мне в этом? извините за мой плохой английский. :)

- (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; 
} 
+0

укажите ссылку здесь, я загружу его ... –

+0

Так в чем проблема? Не удается увидеть изображение, которое вы можете загрузить. – Astoria

+0

cell.textLabel.numberoflines = 0; –

ответ

1

Если вы используете столовую и знаете количество элементов, вы можете поместить ярлык в ячейку и использовать их все. Но вы должны установить метку метки:

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; 

UILabel * caption =(UILabel*)[cell viewWithTag:(1)]; 

caption.text = ... 

Также вы можете использовать UIimage таким же образом.