У меня есть TableViewCell и загрузка данных с помощью веб-службы (JSON), данные, хранящиеся в различном массиве и загрузке данных в виде таблицы. Я хочу, чтобы размер данных массива был большим и небольшим. так как будет управлять размером метки. Я попробовал примеры, но не делал динамическую метку. пожалуйста, помогите, спасибо.Как установить размер динамической метки в UITableViewCell
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [title count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//NSLog(@"tableview cell");
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"event"];
if (cell==nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"Cell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
NSData* imageData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString: [img objectAtIndex:indexPath.row]]];
UIImage* image = [[UIImage alloc] initWithData:imageData];
cell.img.image =image;
cell.lbl_1.text=[NSString stringWithFormat:@"%@",[title objectAtIndex:indexPath.row]];
cell.lbl_2.text=[NSString stringWithFormat:@"%@",[des objectAtIndex:indexPath.row]];
cell.lbl_3.text=[NSString stringWithFormat:@"%@",[evnt_ary objectAtIndex:indexPath.row]];
return cell;
}
Дубликат: - http://stackoverflow.com/q/13190425/3515115 –
http://www.appcoda.com/self-sizing-cells/ посмотреть ссылку –
@balkaransingh please wait Я вижу эту ссылку –