ios swift: Como ter uma célula estática em uma tableview dinâmica?
Eu gostaria de usar umtableView
ter 2 células estáticas no topo de uma lista de células dinâmicas. Tanto quanto eu entendo, eu tenho que usar um protótipo dinâmico tableView. Mas eu não entendo como adicionar 2 células estáticas e projetá-las, por exemplo. adicionando um campo de texto ao primeiro e um rótulo ao segundo.
O que tenho que fazer no meu storyboard? E o que tenho que fazer dentro do Controlador? Como diferenciar a estática das células dinâmicas?
Alguém poderia me dar como iniciante sangrento alguma orientação por onde começar? Muito obrigado!!
EDIT: Eu tentei isso para testar:
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCellWithIdentifier("cardCell", forIndexPath: indexPath) as CardTableViewCell
//static cell
if (indexPath.row < 2) {
cell.dyn.text = "static \(indexPath.row)"
return cell;
}
// Configure the cell...
cell.dyn.text = "buh"
return cell
}
isso resulta no seguinte:
Mais tarde, quando uso dados reais, perderei as 2 primeiras linhas de dados ... Posso "redefinir" o contador de linhas depois de criar minhas células estáticas?
E como posso modificar as 2 células estáticas? Para adicionar um campo de texto e rótulos? Ou eu tenho que fazer isso programaticamente?