У меня есть uiview внутри uitableviewcell (скажем, контейнер). Я хочу добавить еще один uiview в качестве подвеса в этот контейнер. Вот что я делаю. < /p>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"Cell";
static NSString *expandedCellIdentifier = @"ExpandedCell";
if (!isExpanded) {
ListCell *cell =(ListCell*) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell==nil) {
NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"ListCell" owner:self options:nil];
cell = nibs[0];
}
cell.Name.text = [[bArray objectAtIndex:indexPath.row]valueForKey:@"Name"];
return cell;
}
else{
expCell =(ExpandedCell*) [tableView dequeueReusableCellWithIdentifier:expandedCellIdentifier]; //Made this global iVar to refrence it from other methods.
if (expCell==nil) {
NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"ExpandedCell" owner:self options:nil];
expCell = nibs[0];
lDView = [[[NSBundle mainBundle]loadNibNamed:@"lDView" owner:self options:nil]firstObject]; //lDView is a UIView subclass.
[lDView setFrame:CGRectMake(0, 0, 225, 90)];
[lDView setBackgroundColor:[UIColor grayColor]];
//more code.
}
return expCell;
}
return nil;
}
< /code>
Теперь я добавляю это ' ldview < /em>' в подвод после заполнения его некоторыми кнопками, подобными этому. < /p>
-(void)addButtons{
//Add buttons here
[lDView.containerScrollView addSubview:btn];
[expandedCell.containerView addSubview:lDView]; //Doesn't add it to each and every table View cell.Its loading sometimes and sometimes doesn't show up.
Подробнее здесь: https://stackoverflow.com/questions/256 ... -correctly
Как правильно загрузить подсуд из NIB в iOS? ⇐ IOS
Программируем под IOS
-
Anonymous
1759218320
Anonymous
У меня есть uiview внутри uitableviewcell (скажем, контейнер). Я хочу добавить еще один uiview в качестве подвеса в этот контейнер. Вот что я делаю. < /p>
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"Cell";
static NSString *expandedCellIdentifier = @"ExpandedCell";
if (!isExpanded) {
ListCell *cell =(ListCell*) [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell==nil) {
NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"ListCell" owner:self options:nil];
cell = nibs[0];
}
cell.Name.text = [[bArray objectAtIndex:indexPath.row]valueForKey:@"Name"];
return cell;
}
else{
expCell =(ExpandedCell*) [tableView dequeueReusableCellWithIdentifier:expandedCellIdentifier]; //Made this global iVar to refrence it from other methods.
if (expCell==nil) {
NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"ExpandedCell" owner:self options:nil];
expCell = nibs[0];
lDView = [[[NSBundle mainBundle]loadNibNamed:@"lDView" owner:self options:nil]firstObject]; //lDView is a UIView subclass.
[lDView setFrame:CGRectMake(0, 0, 225, 90)];
[lDView setBackgroundColor:[UIColor grayColor]];
//more code.
}
return expCell;
}
return nil;
}
< /code>
Теперь я добавляю это ' ldview < /em>' в подвод после заполнения его некоторыми кнопками, подобными этому. < /p>
-(void)addButtons{
//Add buttons here
[lDView.containerScrollView addSubview:btn];
[expandedCell.containerView addSubview:lDView]; //Doesn't add it to each and every table View cell.Its loading sometimes and sometimes doesn't show up.
Подробнее здесь: [url]https://stackoverflow.com/questions/25620601/how-to-load-a-subview-from-nib-in-ios-correctly[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия