Ir para conteúdo
  • Cadastre-se

Dan Mori

Membros
  • Total de itens

    6
  • Registrou-se em

  • Última visita

Tudo que Dan Mori postou

  1. Como usar a tableView em geral é muito abrangente, porém em geral tudo gira em torno do DataSource e Delegate. Geralmente é mais interessante utilizar o UITableViewController ao invés de adicionar um tableView em um VC, porém cada caso é um caso. Um detalhe que vale a pena citar é que se você alimenta a tableView com 10.000 itens, não quer dizer que você tem 10.000 UITableViewCells, pelo contrário, você terá umas 10... enfim, por isso usa-se o método dequeueReusableCellWithIdentifier, pois quando o scroll acontece as cells são criadas. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; Quanto a duvida do torcapio: Se você estiver falando em relação a criação da cell, isso acontece no método do DataSource - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath e você faria algo do tipo: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Identifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; if (cell) { // configurar a cell // exemplo cell.textLabel.text } return cell; } Ou se você estiver falando do usuário selecionar a cell, você pode usar o método do Delegate fazendo algo assim: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell* cell = [tableView cellForRowAtIndexPath:indexPath]; } Enfim, tem bastante coisa nessa área, alias, em todas
  2. Ah, entendi, eu nunca mexi com MacOS mas por curiosidade eu dei uma olhada e pelo o que eu vi os princípios são os mesmos, DataSource e Delegate. https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40004178 https://developer.apple.com/library/mac/documentation/Cocoa/Reference/NSTableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40008622 E sempre vale a pena ler os Guides: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/TableView/Introduction/Introduction.html#//apple_ref/doc/uid/10000026i E dentro do seu programa acredito que o melhor modelo (considerando que você usará linhas e colunas, seria um Array de registros, sendo cada registro um dicionário... ou seja, um Array com Dictionaries... Se eu falei só besteiras... eu não entendi a pergunta hahaha
  3. Bom, eu particularmente nunca utilizei ArrayController para controlar uma UITableView e sim UITableViewDataSource para popular e UITableViewDelegate para responder a ações dos usuários. Eu daria uma olhada nessas documentações https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewDataSource_Protocol/Reference/Reference.html https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html Vou assumir que colunas sejam linhas, no caso você teria um Array _registros e para obter a quantidade de registros usar [_registros count] . Sempre que o usuário adicionar um registro neste array você pode chamar o método [self.tableView reloadData]; Só para não deixar em branco, o que controlaria quantas linhas a tableView tem seria o método: - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index { return [self.registros count] } e - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath para configurar cada cell. Abraço!
  4. Com certeza é possível sim! Você pode fazer uma requisição, retornar um JSON e transformá-lo em um array Eu daria uma olhada na documentação de HTTP Requests https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/WorkingWithHTTPAndHTTPSRequests/WorkingWithHTTPAndHTTPSRequests.html#//apple_ref/doc/uid/TP40010220-CH8-SW1 E também tem o AFNetworking pode ser uma solução também: https://github.com/AFNetworking/AFNetworking Este post também pode ser útil: http://stackoverflow.com/questions/13473811/afnetworking-and-json E lógicamente, do outro lado você terá uma página PHP (por exemplo) retornando um JSON dos dados do seu DB. Abraço!
  5. Bom, se isso acontece somente em algumas células é possível que o Autroshrink esteja como: Minimum Font Scale ao invés do Font Fixed Size. O que você pode fazer é o seguinte, na configuração da Cell: UIFont *cellFont = [ UIFont fontWithName: @"Helvetica-Neue" size: 18.0 ]; cell.textLabel.font = cellFont; Ou modifique no diretamente pela Storyboard. Abraço.
×
×
  • Criar Novo...